caffeinalab / ti.goosh

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

Not getting callback when the app is in background or killed #117

Closed nrpverma closed 5 years ago

nrpverma commented 5 years ago

Module is working so far, Notifications arrive in the app via GCM when the app is running in the foreground and pop up as a notification when the app is in the background not getting the payload

Ti sdk :7.4.0 GA Device's Android Version: 8.1.0 Ti.goosh: v 4.1.1

Thanks

nrpverma commented 5 years ago

[WARN] : W/ti.goosh.IntentService: Show Notification: FALSE [INFO] : {"data":"{\"c.i\": \"null\"}","inBackground":false} [INFO] : GCMIntentService: (IntentService[GCMIntentService--1]) [4,158634] Title: test 12 [INFO] : GCMIntentService: (IntentService[GCMIntentService--1]) [0,158634] Message: test [INFO] : GCMIntentService: (IntentService[GCMIntentService--1]) [0,158634] Ticker: null

Above payload getting when the app in the foreground.

nrpverma commented 5 years ago

Thnks ill try. but when the app is in background or killed not getting callback please help for the same?

nrpverma commented 5 years ago

@Hemantsolanki103 why there is two data object?

"data":{ "data":{

?

reactnative103 commented 5 years ago

Please tell me, you are getting notification in notification bar when your app in background or quit from background?

As per documentation of module, I have sent two json under json. And as per your question you are getting "{"data":"{"c.i": "null"}","inBackground":false}" but you should get proper json in data json object. So that is the reason you have to sent data as a given solution.

nrpverma commented 5 years ago

no, I m not getting the notification in status bar.

nrpverma commented 5 years ago

Device's Android Version : Moto G5 Plus/v8.1.0

Operating System Name = Mac OS X Version = 10.13.6 Architecture = 64bit

CPUs = 4

Memory = 8589934592 Node.js Node.js Version = 8.9.1 npm Version = 6.4.1 Titanium CLI CLI Version = 5.1.1 Titanium SDK SDK Version = 7.4.0.GA SDK Path = /Users/Library/Application Support/Titanium/mobilesdk/osx/7.4.0.GA Target Platform = android

nrpverma commented 5 years ago

yes, i replaced the module with urs.

yes already intialzed this in tiapp.xml:

CHANNEL NAME
reactnative103 commented 5 years ago

Ok, I share appc info of my PC.

Appcelerator Command-Line Interface, version 7.0.6 Name = Mac OS X Version = 10.13.6 Architecture = 64bit

CPUs = 4

Memory = 8.0GB

Node.js Node.js Version = 8.9.4 npm Version = 5.10.0 Appcelerator CLI Installer = 4.2.13 Core Package = 7.0.6 Titanium CLI CLI Version = 5.1.1 node-appc Version = 0.2.44 Titanium SDKs 7.4.1.GA Version = 7.4.1

Tomorrow I will try to provide you small video for demo or my sample application.

Jei commented 5 years ago

We've just released a new version of Ti.Goosh that should solve this problem. You can find it here. I'm closing this issue as it is a duplicate of #114. If you still have the same problem with Ti.Goosh 4.2.0, you can use that thread.

nrpverma commented 5 years ago

@Jei Didn't work, same issue still I'm getting. stuck with this issue since last 3 days.

@Hemantsolanki103 sure Hemant thanks, that would be great.

nrpverma commented 5 years ago

@Hemantsolanki103 i configured as per urs, but still the same issue

Operating System Name = Mac OS X Version = 10.13.6 Architecture = 64bit CPUs = 4 Memory = 8589934592 Node.js Node.js Version = 8.9.4 npm Version = 5.6.0 Titanium CLI CLI Version = 5.1.1 Titanium SDK SDK Version = 7.4.1.GA SDK Path = /Users/Library/Application Support/Titanium/mobilesdk/osx/7.4.1.GA Target Platform = android

reactnative103 commented 5 years ago

Hi,

How you are sending push notification to device? Like via pushtry.com or directly from admin?

At my end I got same issue but I replaced module and send payload whatever gave you. It was working fine either in device or emulator.

Please update me as per above scenario so we think for another solution.

On Tue 27 Nov, 2018, 11:07 AM nrpverma <notifications@github.com wrote:

@Hemantsolanki103 https://github.com/Hemantsolanki103 i configured as per urs, but still the same issue

Operating System Name = Mac OS X Version = 10.13.6 Architecture = 64bit CPUs = 4 Memory = 8589934592 Node.js Node.js Version = 8.9.4 npm Version = 5.6.0 Titanium CLI CLI Version = 5.1.1 Titanium SDK SDK Version = 7.4.1.GA SDK Path = /Users/Library/Application Support/Titanium/mobilesdk/osx/ 7.4.1.GA Target Platform = android

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/caffeinalab/ti.goosh/issues/117#issuecomment-441926157, or mute the thread https://github.com/notifications/unsubscribe-auth/AHsUxqKu-QzhwI8uS_b2KaJUvZfmB294ks5uzM-ngaJpZM4YymKF .

nrpverma commented 5 years ago

I'm using admin portal for the push notification.

i have changed the payload as you suggested but small changes removed the nested data object.

{"to":['your device token'], "data":{ "title":"abc", "alert":"abc", "badge":2 } }

reactnative103 commented 5 years ago

Give me 30mnt I'll share my POC for help.

On Tue 27 Nov, 2018, 11:36 AM nrpverma <notifications@github.com wrote:

I'm using admin portal for the push notification.

i have changed the payload as you suggested but small changes removed the nested data object.

{"to":['your device token'], "data":{ "title":"abc", "alert":"abc", "badge":2 } }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/caffeinalab/ti.goosh/issues/117#issuecomment-441936533, or mute the thread https://github.com/notifications/unsubscribe-auth/AHsUxsStrStf1WV4zFuC3UVqa3ryApbgks5uzNZ7gaJpZM4YymKF .

nrpverma commented 5 years ago

ok, let me try.

reactnative103 commented 5 years ago

I am sure if you send payload correctly, your problem will resolved. If you will not get success again then I try to send my POC application from other medium.

nrpverma commented 5 years ago

Yes, now i m getting payload. but with the error.

[INFO] : Succes data {"data":"{\"alert\":\"your message\",\"title\":\"Working Good\"}","inBackground":false} [ERROR] : V8Exception: Exception occurred at undefined:1: Uncaught SyntaxError: Unexpected end of JSON input

nrpverma commented 5 years ago

I got the above payload when the app is in the foreground.

reactnative103 commented 5 years ago

Great, Please share your callback function where you handle your payload. Second try in background mode.

nrpverma commented 5 years ago

I tried in the background. nothing is happening.

reactnative103 commented 5 years ago

Please share your callback function where you handle your payload. First we resolve your error

nrpverma commented 5 years ago

yes, got resolved, when the app is in the foreground. but the notification not getting when the app is in the background or killed.

reactnative103 commented 5 years ago

PushTest.zip

Please check working POC application for all API level device. Working Mode: Background and Foreground

Test POC application and find what is missing.

nrpverma commented 5 years ago

@Hemantsolanki103, i build ur provided app in my device using my sender id. I sent notification using http://pushtry.com/. i got the payload in the foreground, but when the app got killed didn't receive the notification on status bar.

reactnative103 commented 5 years ago

I get push when application quit accord to below scenario. First send one notification in foreground and then quit application and send push.

reactnative103 commented 5 years ago

With Module : 4.2.0

Scenario: when application launch and quit from background and send push notification, push not come but you launch the application then push previous push will come.

Please check once.

reactnative103 commented 5 years ago

I hope your issue has been resolved.