Open whenmoon opened 4 years ago
Ok, I've almost got it and it uses the Telecom API (I think) which is great, but the notification will not dismiss on button click:
RNPushNotificationHelper.java line 273:
PendingIntent fullScreenIntent = toScheduleNotificationIntent(bundle);
RNPushNotificationHelper.java line 278:
.setFullScreenIntent(fullScreenIntent, true);
AndroidManifest.xml add singleTask:
<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:launchMode="singleTask"
Anyone have any idea how the button presses can be hooked in to?
Using PushNotification.cancelLocalNotifications()
doesn't work.
Ok I got it working!
I used this method: clearLocalNotification(id)
where id must be an integer.
PushNotification.configure({
onNotification: (notification) => {
//Code to print array into console
console.log(notification);
//Code to be executed according to the action selected by the user
if (notification.action === "Answer") {
console.log('%c notification.action === "ANSWER"', 'color: green;',);
PushNotification.clearLocalNotification(1);
}
else if (notification.action === "Decline") {
console.log('%c notification.action === "DECLINE"', 'color: green;',);
}
},
popInitialNotification: true,
requestPermissions: true,
});
This basically provides the same interface that Whatsapp or HouseParty provide on an incoming call, which is what I've been looking for almost a year. I'm no Java dev so can't make a pr, but is there a plan to 'officially' support anything this?
@whenmoon I am trying to achieve the same functionality like this for my app. Do you have any more details on how you achieved this? Thanks
Hi @twelvearrays, you can either follow the steps above or use this - I forked the current dev branch and published on npm: https://www.npmjs.com/package/react-native-push-notification-full-screen-intent
Hi @twelvearrays, you can either follow the steps above or use this - I forked the current dev branch and published on npm: https://www.npmjs.com/package/react-native-push-notification-full-screen-intent
This is not working for me. I get notifs but not in full screen? Any special settings for that? @whenmoon can you also, if it's not too much trouble, upload a video demonstrating the full screen notifs?
Checkout this PR I think it might help: https://github.com/zo0r/react-native-push-notification/pull/2112
Question
Hi, I'm looking to move away from custom Java modules for notifications to a React Native package. Currently I am using
.setFullScreenIntent(action, true);
in my notification builder, but I can't find anything similar in this package. Is there a way to do it, hacky or non-hacky?