diff --git a/app/build.gradle b/app/build.gradle index 00ebdad88..af82672fd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -99,6 +99,10 @@ android { resValue "string", "sync_account_type", getPackageName() + ".sync" resValue "string", "file_provider", getPackageName() + ".provider" resValue "string", "linphone_address_mime_type", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address" + + if (!firebaseEnabled()) { + resValue "string", "gcm_defaultSenderId", "none" + } } debug { applicationIdSuffix ".debug" @@ -109,6 +113,10 @@ android { resValue "string", "sync_account_type", getPackageName() + ".sync" resValue "string", "file_provider", getPackageName() + ".provider" resValue "string", "linphone_address_mime_type", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address" + + if (!firebaseEnabled()) { + resValue "string", "gcm_defaultSenderId", "none" + } } } diff --git a/app/src/main/java/org/linphone/LinphoneManager.java b/app/src/main/java/org/linphone/LinphoneManager.java index bdfd9dbc2..49a370985 100644 --- a/app/src/main/java/org/linphone/LinphoneManager.java +++ b/app/src/main/java/org/linphone/LinphoneManager.java @@ -754,6 +754,9 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou private void initPushNotificationsService() { if (getString(R.string.push_type).equals("firebase")) { + Log.i( + "[Push Notification] firebase push sender id " + + getString(R.string.gcm_defaultSenderId)); try { FirebaseInstanceId.getInstance() .getInstanceId() @@ -762,21 +765,19 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou @Override public void onComplete(@NonNull Task task) { if (!task.isSuccessful()) { - Log.w( + Log.e( "[Push Notification] firebase getInstanceId failed: " + task.getException()); return; } String token = task.getResult().getToken(); - Log.i( - "[Push Notification] init push notif service token is: " - + token); + Log.i("[Push Notification] firebase token is: " + token); LinphonePreferences.instance() .setPushNotificationRegistrationID(token); } }); } catch (Exception e) { - Log.i("[Push Notification] firebase not available."); + Log.e("[Push Notification] firebase not available."); } } } diff --git a/app/src/main/java/org/linphone/settings/LinphonePreferences.java b/app/src/main/java/org/linphone/settings/LinphonePreferences.java index 930dd9edc..7aaf1817d 100644 --- a/app/src/main/java/org/linphone/settings/LinphonePreferences.java +++ b/app/src/main/java/org/linphone/settings/LinphonePreferences.java @@ -950,7 +950,7 @@ public class LinphonePreferences { if (enable) { // Add push infos to exisiting proxy configs String regId = getPushNotificationRegistrationID(); - String appId = getString(R.string.push_sender_id); + String appId = getString(R.string.gcm_defaultSenderId); if (regId != null && lc.getProxyConfigList().length > 0) { for (ProxyConfig lpc : lc.getProxyConfigList()) { if (lpc == null) continue; @@ -1558,7 +1558,7 @@ public class LinphonePreferences { prxCfg.setQualityReportingInterval(tempQualityReportingInterval); String regId = LinphonePreferences.instance().getPushNotificationRegistrationID(); - String appId = LinphonePreferences.instance().getString(R.string.push_sender_id); + String appId = LinphonePreferences.instance().getString(R.string.gcm_defaultSenderId); if (regId != null && LinphonePreferences.instance().isPushNotificationEnabled()) { String contactInfos = "app-id="