Fix for push information not being set if network down at configuration time

This commit is contained in:
Sylvain Berfini 2016-07-11 16:47:44 +02:00
parent 4473782f86
commit 7074db040a
5 changed files with 11 additions and 2 deletions

View file

@ -792,6 +792,12 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
mLastNetworkType=curtype;
}
}
if (mLc.isNetworkReachable()) {
// When network isn't available, push informations might not be set. This should fix the issue.
LinphonePreferences prefs = LinphonePreferences.instance();
prefs.setPushNotificationEnabled(prefs.isPushNotificationEnabled());
}
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)

View file

@ -1017,7 +1017,7 @@ public class LinphonePreferences {
lpc.edit();
lpc.setContactUriParameters(contactInfos);
lpc.done();
Log.d("Push notif infos added to proxy config");
Log.d("Push notif infos added to proxy config " + lpc.getAddress().asStringUriOnly());
}
lc.refreshRegisters();
}
@ -1027,7 +1027,7 @@ public class LinphonePreferences {
lpc.edit();
lpc.setContactUriParameters(null);
lpc.done();
Log.d("Push notif infos removed from proxy config");
Log.d("Push notif infos removed from proxy config " + lpc.getAddress().asStringUriOnly());
}
lc.refreshRegisters();
}

View file

@ -69,6 +69,7 @@ public class ApiElevenPlus {
| Notification.DEFAULT_SOUND
| Notification.DEFAULT_VIBRATE)
.setWhen(System.currentTimeMillis())
.setNumber(msgCount)
.setLargeIcon(contactIcon).getNotification();
return notif;

View file

@ -56,6 +56,7 @@ public class ApiSixteenPlus {
| Notification.DEFAULT_VIBRATE)
.setWhen(System.currentTimeMillis())
.setLargeIcon(contactIcon)
.setNumber(msgCount)
.build();
return notif;

View file

@ -54,6 +54,7 @@ public class ApiTwentyOnePlus {
.setCategory(Notification.CATEGORY_MESSAGE)
.setVisibility(Notification.VISIBILITY_PRIVATE)
.setPriority(Notification.PRIORITY_HIGH)
.setNumber(msgCount)
.build();
return notif;