Read firebase push sender if from google-services.json instead of non_localizable_custom
This commit is contained in:
parent
85fa30623d
commit
86ca3ac16b
3 changed files with 16 additions and 7 deletions
|
@ -99,6 +99,10 @@ android {
|
||||||
resValue "string", "sync_account_type", getPackageName() + ".sync"
|
resValue "string", "sync_account_type", getPackageName() + ".sync"
|
||||||
resValue "string", "file_provider", getPackageName() + ".provider"
|
resValue "string", "file_provider", getPackageName() + ".provider"
|
||||||
resValue "string", "linphone_address_mime_type", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address"
|
resValue "string", "linphone_address_mime_type", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address"
|
||||||
|
|
||||||
|
if (!firebaseEnabled()) {
|
||||||
|
resValue "string", "gcm_defaultSenderId", "none"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
debug {
|
debug {
|
||||||
applicationIdSuffix ".debug"
|
applicationIdSuffix ".debug"
|
||||||
|
@ -109,6 +113,10 @@ android {
|
||||||
resValue "string", "sync_account_type", getPackageName() + ".sync"
|
resValue "string", "sync_account_type", getPackageName() + ".sync"
|
||||||
resValue "string", "file_provider", getPackageName() + ".provider"
|
resValue "string", "file_provider", getPackageName() + ".provider"
|
||||||
resValue "string", "linphone_address_mime_type", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address"
|
resValue "string", "linphone_address_mime_type", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address"
|
||||||
|
|
||||||
|
if (!firebaseEnabled()) {
|
||||||
|
resValue "string", "gcm_defaultSenderId", "none"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -754,6 +754,9 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
|
|
||||||
private void initPushNotificationsService() {
|
private void initPushNotificationsService() {
|
||||||
if (getString(R.string.push_type).equals("firebase")) {
|
if (getString(R.string.push_type).equals("firebase")) {
|
||||||
|
Log.i(
|
||||||
|
"[Push Notification] firebase push sender id "
|
||||||
|
+ getString(R.string.gcm_defaultSenderId));
|
||||||
try {
|
try {
|
||||||
FirebaseInstanceId.getInstance()
|
FirebaseInstanceId.getInstance()
|
||||||
.getInstanceId()
|
.getInstanceId()
|
||||||
|
@ -762,21 +765,19 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
@Override
|
@Override
|
||||||
public void onComplete(@NonNull Task<InstanceIdResult> task) {
|
public void onComplete(@NonNull Task<InstanceIdResult> task) {
|
||||||
if (!task.isSuccessful()) {
|
if (!task.isSuccessful()) {
|
||||||
Log.w(
|
Log.e(
|
||||||
"[Push Notification] firebase getInstanceId failed: "
|
"[Push Notification] firebase getInstanceId failed: "
|
||||||
+ task.getException());
|
+ task.getException());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String token = task.getResult().getToken();
|
String token = task.getResult().getToken();
|
||||||
Log.i(
|
Log.i("[Push Notification] firebase token is: " + token);
|
||||||
"[Push Notification] init push notif service token is: "
|
|
||||||
+ token);
|
|
||||||
LinphonePreferences.instance()
|
LinphonePreferences.instance()
|
||||||
.setPushNotificationRegistrationID(token);
|
.setPushNotificationRegistrationID(token);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.i("[Push Notification] firebase not available.");
|
Log.e("[Push Notification] firebase not available.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -950,7 +950,7 @@ public class LinphonePreferences {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
// Add push infos to exisiting proxy configs
|
// Add push infos to exisiting proxy configs
|
||||||
String regId = getPushNotificationRegistrationID();
|
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) {
|
if (regId != null && lc.getProxyConfigList().length > 0) {
|
||||||
for (ProxyConfig lpc : lc.getProxyConfigList()) {
|
for (ProxyConfig lpc : lc.getProxyConfigList()) {
|
||||||
if (lpc == null) continue;
|
if (lpc == null) continue;
|
||||||
|
@ -1558,7 +1558,7 @@ public class LinphonePreferences {
|
||||||
prxCfg.setQualityReportingInterval(tempQualityReportingInterval);
|
prxCfg.setQualityReportingInterval(tempQualityReportingInterval);
|
||||||
|
|
||||||
String regId = LinphonePreferences.instance().getPushNotificationRegistrationID();
|
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()) {
|
if (regId != null && LinphonePreferences.instance().isPushNotificationEnabled()) {
|
||||||
String contactInfos =
|
String contactInfos =
|
||||||
"app-id="
|
"app-id="
|
||||||
|
|
Loading…
Reference in a new issue