I am facing an issue like the permission dialog does not show.
Below is libs:
firebase: ^7.2.0
firebase_core: ^0.4.3+2
firebase_analytics: ^5.0.10
firebase_messaging: ^6.0.9
firebase_auth: ^0.15.4
google_sign_in: ^4.1.1
And here is code
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
@override
void initState() {
super.initState();
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
print("onMessage: $message");
},
onLaunch: (Map<String, dynamic> message) async {
print("onLaunch: $message");
},
onResume: (Map<String, dynamic> message) async {
print("onResume: $message");
},
);
_firebaseMessaging.requestNotificationPermissions(
const IosNotificationSettings(
sound: true, badge: true, alert: true, provisional: true));
_firebaseMessaging.onIosSettingsRegistered
.listen((IosNotificationSettings settings) {
print("Settings registered: $settings");
});
_firebaseMessaging.getToken().then((String token) {
print("token: $token");
});
}
The code run well but permission does not show.
I saw in log and see
flutter: token: erwY-nUtvjs:APA91bFE69nLycjJBFjW1ANEpQSYPTaZbGBWEwtdSE1hGMLw6NOsnbCqla7kDyIoFJawVSKH4cWI7SJXFROD7VdRL9HPnukPp4xiJdNgkmudoRIcIiiiBQ-MrMhTRH4BKPyhcYaI-Z9D
flutter: Settings registered: PushNotificationSettings {sound: false, alert: false, badge: false, provisional: true}
Hi @diegothucao
can you please provide your flutter doctor -v
and your flutter run --verbose
Thank you
@diegodalbosco are you able to solve the problem? in ios 13 you are facing the problem ? or ios 12?
how to remove notificationcenter in flutter ? https://github.com/FirebaseExtended/flutterfire/issues/1690#issuecomment-569544506
yep, i solved it
It could be
_firebaseMessaging.requestNotificationPermissions(
const IosNotificationSettings(
sound: true, badge: true, alert: true, provisional: false));
not
_firebaseMessaging.requestNotificationPermissions(
const IosNotificationSettings(
sound: true, badge: true, alert: true, provisional: true));
Then it works
Hi @diegothucao
I'm glad to hear that you solved the issue
thank you for letting me know
@diegothucao what is the FCM payload key you are adding to view the notification in ios 13 , 12 system's notification tray? any specific config required for ios 13 any help would be great! Thanks for sharing
(ios 13 issues https://onesignal.com/blog/ios-13-introduces-4-breaking-changes-to-notifications/)
Could everyone who still has this problem please file a new issue with the exact descriptions what happens, logs and the output of 'flutter doctor -v' please.
All system setups can be slightly different so it's always better to open new issues and reference related issues.
yep, i solved it
It could be_firebaseMessaging.requestNotificationPermissions( const IosNotificationSettings( sound: true, badge: true, alert: true, provisional: false));not
_firebaseMessaging.requestNotificationPermissions( const IosNotificationSettings( sound: true, badge: true, alert: true, provisional: true));Then it works
why setting provisional: false works?
what provisional: false means?
@sultanmyrza ,
UNAuthorizationOption is provisional authorization. If you don’t mind your notifications being delivered quietly, you can set true in provisional to your authorization options. This means that you don’t have to prompt the user to allow notifications — the notifications will still show up in the Notification Center.
refer here --->
https://www.smashingmagazine.com/2018/09/preparing-your-app-for-ios-12-notifications/
Most helpful comment
yep, i solved it
It could be
not
Then it works