You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.
class NotifHandler {
onNotification(notification) {
console.log('onNotifHandler:', notification);
if (typeof this._onNotification === 'function') {
this._onNotification(notification);
}
}
onRegister(token) {
// console.log('NotifHandler:', token);
if (typeof this._onRegister === 'function') {
this._onRegister(token);
}
}
onRemoteFetch(notificationData) {
console.log('onRemoteFetchNotifHandler:', notificationData);
}
attachRegister(handler) {
this._onRegister = handler;
}
attachNotification(handler) {
this._onNotification = handler;
}
}
const handler = new NotifHandler();
PushNotification.configure({
// (optional) Called when Token is generated (iOS and Android)
onRegister: handler.onRegister.bind(handler),
// (required) Called when a remote or local notification is opened or received
onNotification: handler.onNotification.bind(handler),
// IOS ONLY (optional): default: all - Permissions to register.
permissions: {
alert: true,
badge: true,
sound: true,
},
// Should the initial notification be popped automatically
// default: true
popInitialNotification: true,
/**
* (optional) default: true
* - Specified if permissions (ios) and token (android and ios) will requested or not,
* - if not, you must call PushNotificationsHandler.requestPermissions() later
*/
requestPermissions: true,
});
But after 10 seconds notification is work well, but onNotification seems not working when notification is showing.
How to get callback notification when showing, not by tapping?
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I try to implementation like this:
But after 10 seconds notification is work well, but
onNotification
seems not working when notification is showing.How to get callback notification when showing, not by tapping?
The text was updated successfully, but these errors were encountered: