i am developing a react native expo app in which i need a scheduler which help me to notify me , for some specific time but in android this background notification is not working can anyone help me i need urgent.another thing in some mobile it is working but not in majority
registerForPushNotificationsAsync()
.then((token) => {
console.log("token: ", token);
if (customUser && token && customUser.expoPushToken !== token) {
updateExpoPushToken(customUser.userId, token)
.then((action) => {
if (action) {
dispatch(action);
}
})
.catch((error) => {
console.log(error);
});
}
})
.catch((error) => {
console.log("Error registering for push notifications: ", error);
});
Notifications.setNotificationHandler({
handleNotification: async () => ({
shouldShowAlert: true,
shouldPlaySound: true,
shouldSetBadge: true,
}),
});
notificationListener.current =
Notifications.addNotificationReceivedListener((notification) => {
setNotification(notification);
console.log(
"notification received: " + notification.request.content.body
);
});
return () => {
if (notificationListener.current) {
Notifications.removeNotificationSubscription(
notificationListener.current
);
}
if (responseListener.current) {
Notifications.removeNotificationSubscription(responseListener.current);
}
};
}, [Notifications]);
function redirect(notification: Notifications.Notification) {
const url = notification.request.content.data?.url;
if (url) {
router.push(url);
}
}`
i tried expo push notification document and did same like them but didn't get successful result as it is working in some mobile mean i can receive background notification but not some mobile what to do