diff --git a/android/build.gradle b/android/build.gradle index c2037065a..7c9d2fda6 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -84,7 +84,7 @@ tasks.withType(com.android.build.gradle.internal.tasks.AndroidTestTask) { task - apply from: '../dependencies.gradle' apply from: './dependencies.gradle' dependencies { - implementation 'com.google.firebase:firebase-messaging:17.3.4' + implementation 'com.google.firebase:firebase-messaging:22.0.0' androidTestImplementation 'com.android.support.test:runner:0.5' androidTestImplementation 'com.android.support.test:rules:0.5' androidTestImplementation 'com.crittercism.dexmaker:dexmaker:1.4' diff --git a/android/src/main/java/io/ably/lib/push/ActivationContext.java b/android/src/main/java/io/ably/lib/push/ActivationContext.java index c89e2f287..c70f4280e 100644 --- a/android/src/main/java/io/ably/lib/push/ActivationContext.java +++ b/android/src/main/java/io/ably/lib/push/ActivationContext.java @@ -5,9 +5,8 @@ import android.preference.PreferenceManager; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; -import com.google.firebase.FirebaseApp; -import com.google.firebase.iid.FirebaseInstanceId; -import com.google.firebase.iid.InstanceIdResult; +import com.google.firebase.installations.FirebaseInstallations; +import com.google.firebase.installations.InstallationTokenResult; import io.ably.lib.rest.AblyRest; import io.ably.lib.types.AblyException; import io.ably.lib.types.Callback; @@ -151,10 +150,10 @@ public static ActivationContext getActivationContext(Context applicationContext, protected void getRegistrationToken(final Callback callback) { Log.v(TAG, "getRegistrationToken(): callback=" + callback); - FirebaseInstanceId.getInstance().getInstanceId() - .addOnCompleteListener(new OnCompleteListener() { + FirebaseInstallations.getInstance().getToken(true) + .addOnCompleteListener(new OnCompleteListener() { @Override - public void onComplete(Task task) { + public void onComplete(Task task) { Log.v(TAG, "getRegistrationToken(): firebase called onComplete(): task=" + task); if(task.isSuccessful()) { /* Get new Instance ID token */ diff --git a/android/src/main/java/io/ably/lib/push/ActivationStateMachine.java b/android/src/main/java/io/ably/lib/push/ActivationStateMachine.java index d478b4549..9c397f716 100644 --- a/android/src/main/java/io/ably/lib/push/ActivationStateMachine.java +++ b/android/src/main/java/io/ably/lib/push/ActivationStateMachine.java @@ -5,11 +5,8 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; -import android.support.v4.content.LocalBroadcastManager; -import com.google.android.gms.tasks.OnCompleteListener; -import com.google.android.gms.tasks.Task; -import com.google.firebase.iid.InstanceIdResult; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import com.google.gson.JsonObject; import java.lang.reflect.Constructor;