Skip to content

Commit

Permalink
Merge pull request #687 from ably/597-FMC-getToken-depricated-method
Browse files Browse the repository at this point in the history
Updated Firebase cloud messaging dependency
  • Loading branch information
QuintinWillison authored Jul 26, 2021
2 parents 31d8ae4 + 541e822 commit 4a785a4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
11 changes: 5 additions & 6 deletions android/src/main/java/io/ably/lib/push/ActivationContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -151,10 +150,10 @@ public static ActivationContext getActivationContext(Context applicationContext,

protected void getRegistrationToken(final Callback<String> callback) {
Log.v(TAG, "getRegistrationToken(): callback=" + callback);
FirebaseInstanceId.getInstance().getInstanceId()
.addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
FirebaseInstallations.getInstance().getToken(true)
.addOnCompleteListener(new OnCompleteListener<InstallationTokenResult>() {
@Override
public void onComplete(Task<InstanceIdResult> task) {
public void onComplete(Task<InstallationTokenResult> task) {
Log.v(TAG, "getRegistrationToken(): firebase called onComplete(): task=" + task);
if(task.isSuccessful()) {
/* Get new Instance ID token */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4a785a4

Please sign in to comment.