-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
firebase notifications when app is closed #47
Comments
Same problem here. Did you find a solution? |
might be related to https://jira.appcelerator.org/browse/TIMOB-24316 i know there's some titanium issues regarding intents in general. Hopefully those will be fixed in 6.0.4 |
Issue is with the Modules parseBootIntent method it should be setting: |
can you test and create a pull request for this? |
The issue @Bertuzb mentioned seems related. The pull request for the fix includes this commit tidev/titanium-sdk@dddb6a3
|
im running 6.0.4 now though but I still cant seem to receive notification data in-app (after clicking notification) while having the app in background |
I'll make some tests shortly |
https://gist.github.com/Bertuzb/217b080b935aab362c72b213c3625368 its the testcase I used. Basically, the |
[x] App closed: Notification is received and callback is fired when tapped on it Tested with SDK 6.0.0.GA and all cases still work. |
You should always call $.index.open();
var TiGoosh = require('ti.goosh');
TiGoosh.registerForPushNotifications({
// The callback to invoke when a notification arrives.
callback: function(e) {
alert(e.data);
/*var data = JSON.parse(e.data || '');
Ti.API.debug("Callback", data);*/
},
// The callback invoked when you have the device token.
success: function(e) {
// Send the e.deviceToken variable to your PUSH server
Ti.API.debug('Notifications: device token is ' + e.deviceToken);
},
// The callback invoked on some errors.
error: function(err) {
Ti.API.error('Notifications: Retrieve device token failed', err);
}
}); |
can you test the additional If you could provide your testcase that would be awesome too. I've loaded the register function of TiGoosh immediately upon startup but it does not make a change in comparison to clicking a label and firing it that way |
Also that first comment confused me, a fork of 6_0_X with "some new features" but last line says you tested with 6.0.0.GA |
I tested the module with both our fork of the sdk 6.0.4.GA and the official sdk 6.0.0.GA and it works every time. The code I'm using is the one I provided in the comment above. |
what do you do exactly with the google play services? I notice i get an error stating
but i am not sure how to install these and how to make it work with various android devices. Until now I was under the assumption this did not affect this issue, but perhaps it does? |
The message is obsolete. It's a bug in google play services but doesn't impact on the module. It works nonetheless |
last thing i can find is this error im getting:
Im using a Samsung Galaxy S3 but its running Android 7.1 (LineageOS). I have also tried on an Android 6.0.1 device but it does not throw the above error. Both devices will not call the callback even though its registered on startup. Can you post the tiapp manifest? |
hold on im experiencing some differences between the api endpoints https://android.googleapis.com/gcm/send (old one which this module implies) I am getting correct callback events indeed on the gcm variant |
well this seems to have something to do with https://firebase.google.com/docs/cloud-messaging/concept-options#notifications_and_data_messages . The payload im sending to $data = json_encode(
[
$sendKey => $to,
'notification' => ..., // title and body as seen in https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support
'data' => [
'data' => $data // some custom data
]
]
); Removing the The I will try some tests with the |
Yeah that's true. I remember, I answered this in a previous issue. |
ok thanks for the effort you put into this. I will try to convert my api call to use the data-setup, but i might receive conflicts on the iOS side. It might be a good idea as well to put a notice somewhere in the readme, that points the difference out vs |
Yeah true. We'll update the documentation. Thanks for the feedback |
hallo , I have problem I use SDK: 6.0.4 , Appcelerator Studio build: 4.8.1 My problem is : |
@zulfiandri still encountering this problem? |
I know there where reports before, but are marked as closed and I'm still experiencing the same issue
when my app is in the background and receives a notification it shows properly and i get this log
[DEBUG] D/ti.goosh.IntentService: Push notification received from: 545132955493
[DEBUG] D/ti.goosh.IntentService: Notification key : google.sent_time => 1490879315641 (java.lang.Long)
[DEBUG] D/ti.goosh.IntentService: Notification key : data => {"alert":"Qwer","sound":"default","chatRoomId":"db08cfbe-ec47-4d31-8bd4-f4e308180a6b","force_show_in_foreground":true,"vibrate":true,"chatRoomName":"Ivan Sarpi","title":"Ivan Sarpi"} (java.lang.String)
[DEBUG] D/ti.goosh.IntentService: Notification key : title => Ivan Sarpi (java.lang.String)
[DEBUG] D/ti.goosh.IntentService: Notification key : google.message_id => 0:1490879315646921%%bbb352d4f9fd7ecd (java.lang.String)
[DEBUG] D/ti.goosh.IntentService: Notification key : message => Qwer (java.lang.String)
when i click that notification i get this
[DEBUG] D/ti.goosh.TiGooshPushHandlerActivity: started
[DEBUG] [TiPush]: {"inBackground":true,"data":"{\"alert\":\"Qwer\",\"sound\":\"default\",\"chatRoomId\":\"db08cfbe-ec47-4d31-8bd4-f4e308180a6b\",\"force_show_in_foreground\":true,\"vibrate\":true,\"chatRoomName\":\"Ivan Sarpi\",\"title\":\"Ivan Sarpi\"}"}
[INFO] {"alert":"Qwer","sound":"default","chatRoomId":"db08cfbe-ec47-4d31-8bd4-f4e308180a6b","force_show_in_foreground":true,"vibrate":true,"chatRoomName":"Ivan Sarpi","title":"Ivan Sarpi"}
and it does what it's suppose to do (open a new window)
now, when the app is closed, i get this log when the notification arrives (it shows properly)
[DEBUG] D/ti.goosh.IntentService: Push notification received from: 545132955493
[DEBUG] D/ti.goosh.IntentService: Notification key : google.sent_time => 1490879747307 (java.lang.Long)
[DEBUG] D/ti.goosh.IntentService: Notification key : data => {"alert":"Sfdac","sound":"default","chatRoomId":"db08cfbe-ec47-4d31-8bd4-f4e308180a6b","force_show_in_foreground":true,"vibrate":true,"chatRoomName":"Ivan Sarpi","title":"Ivan Sarpi"} (java.lang.String)
[DEBUG] D/ti.goosh.IntentService: Notification key : title => Ivan Sarpi (java.lang.String)
[DEBUG] D/ti.goosh.IntentService: Notification key : google.message_id => 0:1490879747312886%%bbb352d4f9fd7ecd (java.lang.String)
[DEBUG] D/ti.goosh.IntentService: Notification key : message => Sfdac (java.lang.String)
but when i click it, it only opens the app and doesn't open the new window, it says this in the logs
[DEBUG] D/ti.goosh.TiGooshPushHandlerActivity: started
[ERROR] TiApplication: (main) [45015,45015] No valid root or current activity found for application instance
[INFO] TiRootActivity: (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
[INFO] TiApplication: (main) [1,1] Analytics have been disabled
[WARN] V8Object: (KrollRuntimeThread) [235,236] Runtime disposed, cannot set property 'userAgent'
[WARN] TiApplication: (KrollRuntimeThread) [5,241] Registering module with name already in use.
[INFO] TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.ubqti.mega.UbqtiMegaActivity@7aeb756
[DEBUG] Window: Checkpoint: postWindowCreated()
[WARN] TiApplication: (KrollRuntimeThread) [115,115] Registering module with name already in use.
[DEBUG] D/ti.goosh.TiGooshModule: No notification in Intent
I'm using titanium 6.0.3.GA
and ti.goosh 2.0.5
thanks!
edit:
also, could it be related to this i have in my manifest?
The text was updated successfully, but these errors were encountered: