diff --git a/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseLocalMessagingHelper.java b/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseLocalMessagingHelper.java index 642ef6e7..c959ca75 100644 --- a/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseLocalMessagingHelper.java +++ b/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseLocalMessagingHelper.java @@ -219,7 +219,8 @@ public class RNFirebaseLocalMessagingHelper { return; } - Long fireDate = bundle.getLong("fire_date", Math.round(bundle.getDouble("fire_date"))); + Long fireDate = Math.round(bundle.getDouble("fire_date")); + if (fireDate == 0) { Log.e(TAG, "failed to schedule notification because fire date is missing"); return; diff --git a/lib/modules/messaging/index.js b/lib/modules/messaging/index.js index 1f904f23..1e580c9c 100644 --- a/lib/modules/messaging/index.js +++ b/lib/modules/messaging/index.js @@ -175,10 +175,21 @@ export default class Messaging extends Base { } /** - * Set notification count badge number + * Request notification permission + * @platforms ios + * @returns {*|Promise.<*>} */ - setBadgeNumber() { - FirebaseMessaging.setBadgeNumber(); + requestPermissions() { + return FirebaseMessaging.requestPermissions(); + } + + + /** + * Set notification count badge number + * @param n + */ + setBadgeNumber(n: number) { + FirebaseMessaging.setBadgeNumber(n); } /** @@ -194,7 +205,7 @@ export default class Messaging extends Base { * @param listener * @returns {*} */ - onMessageReceived(listener: Function) { + onMessage(listener: Function) { return DeviceEventEmitter.addListener(EVENT_TYPE.Notification, async(event) => { const data = Object.assign({}, event);