-
Notifications
You must be signed in to change notification settings - Fork 35
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
Push when app is closed (show specific view) #6
Comments
Put this in your app.js: /* When the app is started */
var lastData = gcm.getLastData();
if (lastData) {
... view the notification ...
gcm.clearLastData();
}
/* And when the app is resumed */
Ti.Android.currentActivity.addEventListener("resume", function() {
var lastData = gcm.getLastData();
if (lastData) {
... view the notification ...
gcm.clearLastData();
}
}); |
Okey, now it works. I was calling the function twice, my bad. The problem I have now is that sometimes, when I execute the app and I close it, I don't receive the push. I must open it again (still not receive push) and close it, then I can receive push again. It seems to enter twice in the success function because I can see the Ti.API.Info duplicated (the second one takes a few seconds to appear), but now I'm calling this function once. Any clue? What am I doing wrong? Thank you for your time! |
Maybe check the output of |
I've checked the logcat and when I send a push, I can see this:
But nothing else, and I don't receive the notification. This happends when I close the app before the second success info.. When I receive push the ouptut is:
|
Strange, you should see the |
I think it is because of the registrationId. If it's entering twice in the success function but I quit the app before the second success then it's like the first registration doesn't exists and the second one fails or something, so I'm not able to receive any push. I'm trying to figure out why is the app trying to register for push twice. |
Hi,
I want to show specific view when the user touches the notification. It works when the app is in foreground and background, but it doesn't when the app is closed (it only opens the app and). In the logcat I can't see it never entering in the lastData if, I don't know why.
Is there a way to achieve this?
Here is my code, anyway:
The text was updated successfully, but these errors were encountered: