cordova-plugin-firebase-messaging
cordova-plugin-firebase-messaging copied to clipboard
Add support for click_action
click_action Optional, string
The action associated with a user click on the notification.
- iOS: Corresponds to category in the APNs payload.
- Android: If specified, an activity with a matching intent filter is launched when a user clicks on the notification.
https://developer.apple.com/documentation/usernotifications/declaring_your_actionable_notification_types?language=objc https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/SupportingNotificationsinYourApp.html#//apple_ref/doc/uid/TP40008194-CH4-SW26
You could steal what they have in the cordova-plugin-firebase
Any updates of this?
I am also looking for the same functionality. Any updates on this?
@chemerisuk Any updates on this?
I am not sure if i understood you right but using the onBackgroundMessage should be what you are looking for. This is called, when the user clicks on the notification and the app opens.
I am not sure if i understood you right but using the onBackgroundMessage should be what you are looking for. This is called, when the user clicks on the notification and the app opens.
But it does not fire any callback event when click on the head up notification on android
I am not sure if i understood you right but using the onBackgroundMessage should be what you are looking for. This is called, when the user clicks on the notification and the app opens.
But it does not fire any callback event when click on the head up notification on android
It should. It does fire onBackgroundMessage callback in my code. If nothing happens after the notification being clicked. One possible reason is you have click_action in your fcm notification payload but doesn't have corresponding intent filter setup in your manifest.xml
For those that haven't used Intent filters before (like me) It was a little confusing trying to get it to work but after some trial and error I managed to get it working with this code.
Inside config.xml within the android platform tags:
<!-- notification redirect on notification tap --> <config-file target="AndroidManifest.xml" parent="/manifest/application/activity"> <intent-filter> <action android:name="FCM_PLUGIN_ACTIVITY" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </config-file>
This is what my cloud function looks like: