[messaging] Handle Android exceptions when message priority not set correctly
This commit is contained in:
parent
dd940b953b
commit
33cd0b0b13
|
@ -35,11 +35,15 @@ public class RNFirebaseMessagingService extends FirebaseMessagingService {
|
||||||
// Broadcast it so it is only available to the RN Application
|
// Broadcast it so it is only available to the RN Application
|
||||||
LocalBroadcastManager.getInstance(this).sendBroadcast(messagingEvent);
|
LocalBroadcastManager.getInstance(this).sendBroadcast(messagingEvent);
|
||||||
} else {
|
} else {
|
||||||
// If the app is in the background we send it to the Headless JS Service
|
try {
|
||||||
Intent headlessIntent = new Intent(this.getApplicationContext(), RNFirebaseBackgroundMessagingService.class);
|
// If the app is in the background we send it to the Headless JS Service
|
||||||
headlessIntent.putExtra("message", message);
|
Intent headlessIntent = new Intent(this.getApplicationContext(), RNFirebaseBackgroundMessagingService.class);
|
||||||
this.getApplicationContext().startService(headlessIntent);
|
headlessIntent.putExtra("message", message);
|
||||||
HeadlessJsTaskService.acquireWakeLockNow(this.getApplicationContext());
|
this.getApplicationContext().startService(headlessIntent);
|
||||||
|
HeadlessJsTaskService.acquireWakeLockNow(this.getApplicationContext());
|
||||||
|
} catch (IllegalStateException ex) {
|
||||||
|
Log.e(TAG, "Background messages will only work if the message priority is set to 'high'", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue