Add some additional FCM logging.

This commit is contained in:
Greyson Parrelli 2019-02-06 00:16:51 -08:00
parent 7da73bbc30
commit c364345e1d
2 changed files with 6 additions and 0 deletions

View File

@ -50,6 +50,8 @@ public class FcmService extends FirebaseMessagingService implements InjectableTy
@Override @Override
public void onNewToken(String token) { public void onNewToken(String token) {
Log.i(TAG, "onNewToken()");
if (!TextSecurePreferences.isPushRegistered(getApplicationContext())) { if (!TextSecurePreferences.isPushRegistered(getApplicationContext())) {
Log.i(TAG, "Got a new FCM token, but the user isn't registered."); Log.i(TAG, "Got a new FCM token, but the user isn't registered.");
return; return;

View File

@ -91,6 +91,10 @@ public class FcmRefreshJob extends ContextJob implements InjectableType {
Optional<String> token = FcmUtil.getToken(); Optional<String> token = FcmUtil.getToken();
if (token.isPresent()) { if (token.isPresent()) {
if (!token.get().equals(TextSecurePreferences.getFcmToken(context))) {
Log.i(TAG, "New token differs from the old token.");
}
textSecureAccountManager.setGcmId(token); textSecureAccountManager.setGcmId(token);
TextSecurePreferences.setFcmToken(context, token.get()); TextSecurePreferences.setFcmToken(context, token.get());
TextSecurePreferences.setFcmTokenLastSetTime(context, System.currentTimeMillis()); TextSecurePreferences.setFcmTokenLastSetTime(context, System.currentTimeMillis());