Skip to content

Commit d392efa

Browse files
authored
Guard FCM method calls (#484)
1 parent b51663f commit d392efa

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

AndroidSDKFcm/src/main/java/com/leanplum/LeanplumFcmProvider.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
package com.leanplum;
2323

2424
import com.leanplum.internal.Constants;
25+
import com.leanplum.internal.Log;
2526

2627
/**
2728
* Leanplum provider for work with Firebase.
@@ -49,11 +50,19 @@ public PushProviderType getType() {
4950

5051
@Override
5152
public void updateRegistrationId() {
52-
FirebaseUtilKt.updateRegistrationId(this);
53+
try {
54+
FirebaseUtilKt.updateRegistrationId(this);
55+
} catch (Throwable t) {
56+
Log.e("Error getting FCM token", t);
57+
}
5358
}
5459

5560
@Override
5661
public void unregister() {
57-
FirebaseUtilKt.unregister();
62+
try {
63+
FirebaseUtilKt.unregister();
64+
} catch (Throwable t) {
65+
Log.e("Error unregistering from FCM", t);
66+
}
5867
}
5968
}

0 commit comments

Comments
 (0)