try to catch exceptions on FCM token refresh

This commit is contained in:
Christian Schneppe 2018-11-08 22:24:44 +01:00
parent 9caca380b4
commit f0e96ca60d

View file

@ -1,15 +1,24 @@
package de.pixart.messenger.services;
import android.content.Intent;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import com.google.firebase.iid.FirebaseInstanceIdService;
import de.pixart.messenger.Config;
import de.pixart.messenger.utils.Compatibility;
public class InstanceIdService extends FirebaseInstanceIdService {
@Override
public void onTokenRefresh() {
Intent intent = new Intent(this, XmppConnectionService.class);
intent.setAction(XmppConnectionService.ACTION_FCM_TOKEN_REFRESH);
startService(intent);
try {
startService(intent);
} catch (Exception e) {
Log.e(Config.LOGTAG, "unable to refresh FCM token", e);
}
}
}