How to open app by clicking on push notification?

I am using capacitor for push notification . when I receive a notification i want to open app by clicking on notification but that is not working how I can do it?

// Method called when tapping on a notification
  (notification) => {

    console.log('App opened',notification)

The default behaviour of push notifications is to open the app when you tap them, so unless you did something “weird” it should just work. Hard to know with the little detail you provided.

1 Like

by default it is not opening the app…

You have to change the backend payload for that…

can you please provide me an example?

“to” : “fjS2HYDJvVk:APA91bHbGoGOFKbk6XVhq6nVxU1LxHk48pCUe7P3aZRcMMA4ToXWib4R_eLRoQZeJJpZoklDvv3Yl23wnH4r0-VSX_16O7SD_I9t_vgdoZNCAS1LA0KE9oRz0-59h9JB60WgTwc2enfS”,
“collapse_key” : “type_a”,
“body”:“Its done”,
“content_available”: true

Not sure if this will work though

It won’t open the app on Android if the app has been killed by user. Only when the app is put in the background (but not killed) will the app be opened when you click on it. I’m also having trouble fixing this situation.