[android][messaging] Handle SecuritException in cancelAllLocalNotifications

This commit is contained in:
Akshet Pandey 2017-11-20 16:58:55 -08:00
parent 78a2b0a81a
commit 802c54ade8
1 changed files with 7 additions and 1 deletions

View File

@ -104,7 +104,13 @@ public class RNFirebaseMessaging extends ReactContextBaseJavaModule implements L
@ReactMethod
public void cancelAllLocalNotifications() {
mRNFirebaseLocalMessagingHelper.cancelAllLocalNotifications();
try {
mRNFirebaseLocalMessagingHelper.cancelAllLocalNotifications();
} catch (SecurityException e) {
// In some devices/situations cancelAllLocalNotifications will throw a SecurityException
// We can safely ignore this error for now as the UX impact of this not working is minor.
Log.w(TAG, e.getMessage());
}
}
@ReactMethod