I googled a bunch but can not find a comprehensive answer.
I am getting my token like this
final notificationSettings = await FirebaseMessaging.instance.requestPermission(
alert: true,
announcement: true,
badge: false,
provisional: false,
sound: true
);
final token = await FirebaseMessaging.instance.getToken();
and send my notifications with python firebase messaging
notification = messaging.Notification(
'Title',
'Text'
)
message = messaging.Message(
notification=notification,
token=token
)
messaging.send(message)
The notification arrives, but only in the iPhone notification center. It does not show on the lock screen like all other messages. Do I need to feed in some setting in the app to enable this?
I found that the provisional flag (initially I had it as true) triggers this behavior
https://rnfirebase.io/messaging/ios-permissions#provisional-permission
but I have reset it to false and still my notifications do not show on the lock screen…
2
Answers
So, what I had to do was to DELETE the app and rebuild. This would erase all previous settings, a new token will be created and with the new permission parameters the notifications will show on the lock screen.
On iOS, displaying notifications on the Lock Screen depends on the permissions requested and the notification configuration.
Solution: Ensure that you are requesting permissions correctly on iOS. You could use firebase_messaging plugin to manage this.
Example with firebase_messaging: