upd: push notification on background

Deskripsi:
- on klik pada background notification
- hide and show notificationn foreground

No Issues
This commit is contained in:
2025-08-07 16:25:45 +08:00
parent 9cb848ddd2
commit 7555ece0fa
6 changed files with 49 additions and 35 deletions

View File

@@ -26,19 +26,14 @@ const initializeFirebase = async () => {
// Set auto initialization and background message handler
mess.setAutoInitEnabled(true);
// mess.setBackgroundMessageHandler(async remoteMessage => {
// // console.log('Message handled in the background!', remoteMessage);
// // pushToPage(String(remoteMessage?.data?.category), String(remoteMessage?.data?.content))
// const screen = remoteMessage?.data?.category;
// const content = remoteMessage?.data?.content;
// if (screen && content) {
// await AsyncStorage.setItem('navigateOnOpen', JSON.stringify({ screen, content }));
// }
// });
mess.setBackgroundMessageHandler(async remoteMessage => {
const screen = remoteMessage?.data?.category;
const content = remoteMessage?.data?.content;
if (screen && content) {
await AsyncStorage.setItem('navigateOnOpen', JSON.stringify({ screen, content }));
}
});
return mess
} catch (error) {
console.error('Failed to initialize Firebase:', error);