Wie kann ich die ONDIDRECEIVEBACKORNORTIFICATIFORTICIFICATION -Eigenschaft von FlutterlocalNotificationssplugin.initialiAndroid

Forum für diejenigen, die für Android programmieren
Anonymous
 Wie kann ich die ONDIDRECEIVEBACKORNORTIFICATIFORTICIFICATION -Eigenschaft von FlutterlocalNotificationssplugin.initiali

Post by Anonymous »

Ich versuche, lokale Push -Benachrichtigungen mit Flutter_Local_Notification zu implementieren, und ich möchte bestimmte Aktionen ausführen, wenn FlutterlocalNotificationssplugin.show aufgerufen wird, während die Flutter -App im Hintergrund ist. Ich fand heraus, dass die OndidreceivebackgroundNotificationResponse -Eigenschaft von FlutterlocalNotificationssplugin.initialize der Teil ist, in dem solche Aktionen geschrieben werden sollten. Selbst wenn ich Code wie folgt schreibe, scheint er nicht ausgeführt zu werden. Ich wäre unglaublich dankbar, wenn jemand, der weiß, einige Ratschläge geben könnte. < /P>
Ich gehe davon aus, dass Sie sich auf ein Android-Gerät beziehen. flutterLocalNotificationsPlugin.initialize(
initializationSettings,
onDidReceiveNotificationResponse: (notificationResponse) async {
debugPrint('[onDidReceiveNotificationResponse]');
if (notificationResponse.payload != null) {
debugPrint('notification payload: ${notificationResponse.payload}');
}
},
onDidReceiveBackgroundNotificationResponse: notificationTapBackground,
);
< /code>
/* top-level */
@pragma('vm:entry-point')
void notificationTapBackground(NotificationResponse notificationResponse) {
debugPrint('[notificationTapBackground()]');
}
< /code>
-Version-< /p>
Flutter: 3.10.6
flutter_local_notification: ^14.1.0 < /p>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post