FCM improvements.

This commit is contained in:
Greyson Parrelli
2019-02-15 11:40:03 -08:00
parent 4dbe165c18
commit a6564f8f84
8 changed files with 89 additions and 58 deletions

View File

@@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.gcm;
import android.support.annotation.WorkerThread;
import android.text.TextUtils;
import com.google.firebase.iid.FirebaseInstanceId;
@@ -23,7 +24,7 @@ public final class FcmUtil {
AtomicReference<String> token = new AtomicReference<>(null);
FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(task -> {
if (task.isSuccessful() && task.getResult() != null) {
if (task.isSuccessful() && task.getResult() != null && !TextUtils.isEmpty(task.getResult().getToken())) {
token.set(task.getResult().getToken());
} else {
Log.w(TAG, "Failed to get the token.", task.getException());