我在iOS中遇到了Firebase通知问题,通知的声音不起作用,但是在android中它起作用
*发送通知: Future
*receive notifications:
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
final notification = message['notification'];
_showNotification(notification['body'], 'text2', 'text3');
},
onLaunch: (Map<String, dynamic> message) async {
_showNotification( message['notification']['body'], 'text2', 'text3');
},
onResume: (Map<String, dynamic> message) async {
_showNotification( message['notification']['body'], 'text2', 'text3');
},
);
_firebaseMessaging.requestNotificationPermissions(
const IosNotificationSettings(sound: true, badge: true, alert: true,));
initializationSettingsAndroid =
new AndroidInitializationSettings('app_icon');
initializationSettingsIOS = new IOSInitializationSettings(
onDidReceiveLocalNotification: onDidReceiveLocalNotification);
initializationSettings = new InitializationSettings(
initializationSettingsAndroid, initializationSettingsIOS);
flutterLocalNotificationsPlugin.initialize(initializationSettings,
onSelectNotification: onSelectNotification);