Fix firebase (fix actually backported from dev_group_chat branch, with modifications to handle a build without the google-services jar.)
This commit is contained in:
parent
f70a204d99
commit
a8558d5f29
3 changed files with 14 additions and 5 deletions
|
@ -691,10 +691,18 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
Log.i("[Push Notification] Assuming GCM jar is not provided.");
|
||||
}
|
||||
}else if (getString(R.string.push_type).equals("firebase")){
|
||||
final String refreshedToken = com.google.firebase.iid.FirebaseInstanceId.getInstance().getToken();
|
||||
if (refreshedToken != null) {
|
||||
Log.i("[Push Notification] current token is: " + refreshedToken);
|
||||
LinphonePreferences.instance().setPushNotificationRegistrationID(refreshedToken);
|
||||
try{
|
||||
Class<?> firebaseClass = Class.forName("com.google.firebase.iid.FirebaseInstanceId");
|
||||
Object firebaseInstance = firebaseClass.getMethod("getInstance").invoke(null);
|
||||
final String refreshedToken = (String)firebaseClass.getMethod("getToken").invoke(firebaseInstance);
|
||||
|
||||
//final String refreshedToken = com.google.firebase.iid.FirebaseInstanceId.getInstance().getToken();
|
||||
if (refreshedToken != null) {
|
||||
Log.i("[Push Notification] current token is: " + refreshedToken);
|
||||
LinphonePreferences.instance().setPushNotificationRegistrationID(refreshedToken);
|
||||
}
|
||||
}catch(Exception e){
|
||||
Log.i("[Push Notification] firebase not available.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ public class FirebaseIdService extends FirebaseInstanceIdService {
|
|||
// Get updated InstanceID token.
|
||||
final String refreshedToken = FirebaseInstanceId.getInstance().getToken();
|
||||
android.util.Log.i("FirebaseIdService", "[Push Notification] Refreshed token: " + refreshedToken);
|
||||
|
||||
LinphoneUtils.dispatchOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 88a55217832dfd0ca3f8be98a656646e2136190f
|
||||
Subproject commit 701685a9fca6b420861d1917cbadffae6daee71e
|
Loading…
Reference in a new issue