Wie kann ich die ONDIDRECEIVEBACKORNORTIFICATIFORTICIFICATION -Eigenschaft von FlutterlocalNotificationssplugin.initiali

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Wie kann ich die ONDIDRECEIVEBACKORNORTIFICATIFORTICIFICATION -Eigenschaft von FlutterlocalNotificationssplugin.initiali

by Anonymous » 14 Apr 2025, 21:40

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>

Top