caffeinalab / ti.goosh

GCM/FCM module for Titanium.
MIT License
52 stars 34 forks source link

callback is not called when notification is clicked from notification tray #70

Closed mitulbhalia closed 7 years ago

mitulbhalia commented 7 years ago

I am getting notification correctly but the callback method of module is not calling when notification is clicked.

Tested with module version 2.0.6, 2.0.7 and ti sdk 6.0.0.GA, 6.0.2.GA, 6.0.4.GA

progress44 commented 7 years ago

Please do not open new issues for the same problem. There are already three other opened issues that describe this problem

68 #57 #68

mitulbhalia commented 7 years ago

but my issue is little bit different. Callback is not called even the app is running in background.

progress44 commented 7 years ago

How did you set up the module? Do you call the registerforpushnotifications on every app launch?

mitulbhalia commented 7 years ago

Yes and even app is not crashed when notification is clicked.

mitulbhalia commented 7 years ago

Do you know what should be the issue then? Also app is hanged when push is received in foreground mode and push is not received when app is fully closed, not running in the background.

progress44 commented 7 years ago

Check your payload, there's definitely something wrong there

mitulbhalia commented 7 years ago

From php side?

progress44 commented 7 years ago

yeah

mitulbhalia commented 7 years ago

Ok, thanks

mitulbhalia commented 7 years ago

Here is my payload $msg = array ( "alert" => $_POST['limitedtextarea'] . time(), "title" => 'Notification', 'sound' => 'default', "vibrate" => [100,50,50,50,100], "badge" => 1, "tag" => "Test" );

progress44 commented 7 years ago

It seems correct actually. I'll look into it as soon as I have some time

mitulbhalia commented 7 years ago

Thanks, did you have any chance yet?

mitulbhalia commented 7 years ago

Should i need to follow this link? https://github.com/caffeinalab/ti.goosh/blob/master/test-fcm

progress44 commented 7 years ago

Yeah it's helpful if you can try with that example. You just need to update your google API key and device token.

mitulbhalia commented 7 years ago

Its working...Thank you for your help.

Now the problem is i got below error first time when i clicked notification and thats why callback is not called but when i killed the app from background and run it again then it calls callback. What should be the issue then?

No valid root or current activity found for application instance

mitulbhalia commented 7 years ago

No Worries.... I sorted out :)

Lenndev commented 7 years ago

@mitulbhalia what is your solution for the error you mentioned: "No valid root or current activity found for application instance"? And did this error occur when app was closed or just in background? thnx in advance

mitulbhalia commented 7 years ago

@Lenndev I just followed the above link for back end side and it started to call callback function when app is in background but it still does not call callback when app is closed.