简体   繁体   中英

How can I call a function on local notification received in background in flutter

I want to build one functionality in my flutter app. I am using the awesome_notification package to show scheduled notifications.

Is there any way that I can trigger an API call when a notification is received in the background? (when the app was killed or terminated). I want to do it on the flutter side but You can also suggest how to do it in native android and IOS if it is possible. Native integration would also be accepted.

Please share a demo or example.

Thanks!

iOS Note: In iOS, you can determine whether an application is launched as a result of the user tapping the action button or whether the notification was delivered to the already-running application by examining the application state. In the delegate's implementation of the application:didReceiveRemoteNotification: or application:didReceiveLocalNotification: method, get the value of the applicationState property and evaluate it. If the value is UIApplicationStateInactive, the user tapped the action button; if the value is UIApplicationStateActive, the application was frontmost when it received the notification.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM