mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-04-28 12:06:19 +00:00
Fixes for push notifications
This commit is contained in:
parent
76ae466b08
commit
1b3339928b
2 changed files with 2 additions and 3 deletions
|
|
@ -988,6 +988,7 @@ public class LinphonePreferences {
|
||||||
|
|
||||||
public void setPushNotificationRegistrationID(String regId) {
|
public void setPushNotificationRegistrationID(String regId) {
|
||||||
getConfig().setString("app", "push_notification_regid", regId);
|
getConfig().setString("app", "push_notification_regid", regId);
|
||||||
|
setPushNotificationEnabled(isPushNotificationEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPushNotificationRegistrationID() {
|
public String getPushNotificationRegistrationID() {
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,9 @@ public class ApiEightPlus {
|
||||||
final String regId = (String)GCMRegistrar.getMethod("getRegistrationId", Context.class).invoke(null, context);
|
final String regId = (String)GCMRegistrar.getMethod("getRegistrationId", Context.class).invoke(null, context);
|
||||||
String newPushSenderID = context.getString(R.string.push_sender_id);
|
String newPushSenderID = context.getString(R.string.push_sender_id);
|
||||||
String currentPushSenderID = LinphonePreferences.instance().getPushNotificationRegistrationID();
|
String currentPushSenderID = LinphonePreferences.instance().getPushNotificationRegistrationID();
|
||||||
if (regId.equals("") || currentPushSenderID == null || !currentPushSenderID.equals(newPushSenderID)) {
|
if (regId.equals("") || currentPushSenderID == null) {
|
||||||
GCMRegistrar.getMethod("register", Context.class, String[].class).invoke(null, context, new String[]{newPushSenderID});
|
GCMRegistrar.getMethod("register", Context.class, String[].class).invoke(null, context, new String[]{newPushSenderID});
|
||||||
|
|
||||||
Log.d("Push Notification: storing current sender id = " + newPushSenderID);
|
Log.d("Push Notification: storing current sender id = " + newPushSenderID);
|
||||||
LinphonePreferences.instance().setPushNotificationRegistrationID(newPushSenderID);
|
|
||||||
} else {
|
} else {
|
||||||
Log.d("Push Notification: already registered with id = " + regId);
|
Log.d("Push Notification: already registered with id = " + regId);
|
||||||
LinphonePreferences.instance().setPushNotificationRegistrationID(regId);
|
LinphonePreferences.instance().setPushNotificationRegistrationID(regId);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue