我正在为我的应用程序使用本地通知,它在我的 iPhone 上运行良好,但是在我的Android 模拟器上触发通知时,它没有在屏幕顶部显示通知,而只显示点:
通知实际上在通知中心看起来很好:
我确保init
我的电话instantNotification
看起来像这样:
Future initialize() async {
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
AndroidInitializationSettings androidInitializationSettings =
AndroidInitializationSettings('app_icon');
IOSInitializationSettings iosInitializationSettings =
IOSInitializationSettings();
final InitializationSettings initializationSettings =
InitializationSettings(
android: androidInitializationSettings,
iOS: iosInitializationSettings);
await flutterLocalNotificationsPlugin.initialize(initializationSettings);
}
//Instant Notifications
Future instantNofitication() async {
var android = AndroidNotificationDetails('id', 'channel', 'description');
var ios = IOSNotificationDetails();
var platform = new NotificationDetails(android: android, iOS: ios);
await _flutterLocalNotificationsPlugin.show(
0,
'Demo instant notification',
'Tap to do something',
platform,
payload: 'Welcome to demo app',
);
}
我在这里想念什么?