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; 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) @TargetApi(Build.VERSION_CODES.HONEYCOMB)

View file

@ -1017,7 +1017,7 @@ public class LinphonePreferences {
lpc.edit(); lpc.edit();
lpc.setContactUriParameters(contactInfos); lpc.setContactUriParameters(contactInfos);
lpc.done(); 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(); lc.refreshRegisters();
} }
@ -1027,7 +1027,7 @@ public class LinphonePreferences {
lpc.edit(); lpc.edit();
lpc.setContactUriParameters(null); lpc.setContactUriParameters(null);
lpc.done(); 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(); lc.refreshRegisters();
} }

View file

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

View file

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

View file

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