evollu / evollu/react-native-fcm

Android local scheduleLocalNotification and notification in background not working

Open
#840 6 comments 3 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.7k
Forks
661
PR merge metrics
No merged PRs in 30d

Description

Hello,
**This does not work:**

FCM.scheduleLocalNotification({
id: 'testnotif',
fire_date: new Date().getTime()+5000,
vibrate: 500,
title: 'Hello',
body: 'Test Scheduled Notification',
sub_text: 'sub text',
priority: "high",
show_in_foreground: true,
wake_screen: true,
extra1: {a: 1},
extra2: 1
});

**This works**

FCM.presentLocalNotification({
id: 'testnotif',
fire_date: new Date().getTime()+5000,
vibrate: 500,
title: 'Hello',
body: 'Test Scheduled Notification',
sub_text: 'sub text',
priority: "high",
show_in_foreground: true,
wake_screen: true,
extra1: {a: 1},
extra2: 1
});

This works only when app is in foreground. In background (when app is minimized - not killed) it's not working

setTimeout(() => {
FCM.presentLocalNotification({
id: 'testnotif',
fire_date: new Date().getTime()+5000,
vibrate: 500,
title: 'Hello',
body: 'Test Scheduled Notification',
sub_text: 'sub text',
priority: "high",
show_in_foreground: false, // this does not change anything in this case
wake_screen: true,
extra1: {a: 1},
extra2: 1
});
}, 5000);

1. What version of RN and react-native-fcm are you running?
**"react-native-fcm": "^14.1.0",**
2. What device are you using? (e.g iOS9 emulator, Android 6 device)?
**Android Nexus 5 6.0.1**
3. Is your app running in foreground, background or not running?
Both

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.