evollu / evollu/react-native-fcm

I don't receive notification when I have locked mobile screen.

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

Description

Hi,

I don't receive notification when I have locked mobile screen.

I'm not checking this repo every day since it is fairly stable now. If you have found a bug or need immediate attention please [AT]me

Please include following information for better support

What version of RN and react-native-fcm are you running?
```
"react-native-fcm": "7.5.1"
```
What device are you using? (e.g iOS9 emulator, Android 6 device)?
```
Huawei P7 - Android 5.1 lollipop
```
Is your app running in foreground, background or not running?
```
locked screen
```
OS
```
Android
```
React Native
```
react-native 0.42
```

Advanced:
Have you tried adding break point in native handlers to see if message gets delivered?
can share a project with issue?

I have

```
componentDidMount() {
// if redux persist is not active fire startup action
FCM.requestPermissions();
FCM.getFCMToken()
.then(token => {
console.log(token)
})

FCM.on(FCMEvent.Notification, async (notif) => {
console.log(notif)
if (notif && notif.local_notification) {
return
}
FCM.presentLocalNotification({
vibrate: 500,
title: notif.title,
body: notif.body,
priority: "high",
show_in_foreground: true
})
if (Platform.OS === 'ios') {
switch (notif._notificationType) {
case NotificationType.Remote:
notif.finish(RemoteNotificationResult.NewData); //other types available: RemoteNotificationResult.NewData, RemoteNotificationResult.ResultFailed
break;
case NotificationType.NotificationResponse:
notif.finish();
break;
case NotificationType.WillPresent:
notif.finish(WillPresentNotificationResult.All); //other types available: WillPresentNotificationResult.None
break;
}
}
});

FCM.on(FCMEvent.RefreshToken, token => {
console.log(token);
});
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the notification flow from componentDidMount, especially FCM.on(FCMEvent.Notification) and FCM.presentLocalNotification, with the screen locked on the reported Huawei P7 running Android 5.1. Check whether the message reaches the handler or whether local notification presentation fails; done means a notification is received while the screen is locked, with a regression check for foreground and background behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, firebase, java, react-native
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.