Android: Fullscreen notification bypasses lockscreen and presents entire app (Incoming Calls)
See original GitHub issueHi everyone and thanks to the authors for open-sourcing and maintaining this
Use case: Incoming Call on Lock Screen.
After this exact sequence
1- killing the app
2- awakening it with server-sent high
importance notification below
3- dismissing the notification
4- locking the screen
5- resending the same notification
The notification bypasses lockscreen and just opens the app on top of it, every time, without entering passcode, with full access to the app (but not past the lock screen). Seems like a big footgun.
Is this a bug or a feature ?
More generally: Is it possible today with notifee to get basic Incoming Call notifications going? With similar behavior users expect: turns on lock screen, occupies it full screen and displays/vibrates/rings until interacted with.
mainComponent
sounds like a good lead but it isn’t quite clear in the docs what it can or cannot do (props? navigate back to main app?)
const displayCallNotificationAndroid = async ({
callId,
callerName,
hasVideo,
}: {
callId: string;
callerName: string;
hasVideo: boolean;
}) => {
console.log('📞 📥 displayCallNotificationAndroid: ', callId);
const channelId = await notifee.createChannel({
id: 'nugget-calls',
name: 'nugget-calls',
importance: AndroidImportance.HIGH,
});
const dnr = await notifee.displayNotification({
title: callerName,
body: `is calling you on ${hasVideo ? 'video' : 'voice'}...`,
id: callId,
android: {
channelId,
smallIcon: 'ic_launcher_round',
color: '#dedede',
category: AndroidCategory.CALL,
importance: AndroidImportance.HIGH,
fullScreenAction: {
id: 'default',
},
actions: [
{
title: 'Decline',
pressAction: {
id: 'decline-call',
},
},
{
title: 'Answer',
pressAction: {
id: 'answer-call',
},
},
],
lightUpScreen: true,
// asForegroundService: true,
colorized: true,
},
});
console.log('🔭 displayNotification result: ', dnr);
};
Samsung s10e
Android 12
compileSdkVersion = 31
"react-native": "^0.68.0",
"@react-native-firebase/app": "^13.0.1",
"@react-native-firebase/messaging": "^13.0.1",
"@notifee/react-native": "^5.4.1",
Thanks!
Issue Analytics
- State:
- Created a year ago
- Comments:46 (12 by maintainers)
@shawarmaz I had some issues with callkeep and have been working with notifee to solve this problem. In my case, I created a custom activity - CustomActivity.java in android/app/java/com/MyApp :
Next, I created a simple incoming call notification with notifee:
The fullScreenAction, which calls a customActivity, is an important part of this implementation.
And then, I needed to register this component in my index.js:
I also configured my AndroidManifest.xml this way:
This part will probably solve your problem because you will give permission to show only the custom component (Incoming Call) on the locked screen.
Absolutely, that’s really useful in combination with intentional / intended support for this use case
Not sure that would actually help, I think we’re all about 300% utilized at the moment 😆 - along with you I’m sure
It looks trivial as a bit of code - https://stackoverflow.com/a/8668648/9910298
The hard part will be to implement it well here. I think this belongs in the core library as a feature really, then with react-native wrapping it.
@helenaford if you could wave a wand and say: "drop a boolean method right here in
android/....
and then call it from right here inpackages/react-native/...
where would you put them?