Comments (6)
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();
}
});
from gcmpush.
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!
from gcmpush.
Maybe check the output of adb logcat
and verify whether the push is actually received by the device (or simulator).
from gcmpush.
I've checked the logcat and when I send a push, I can see this:
09-15 12:09:05.795: I/GCM(1534): GCM message [app_package] 0:1442311746300784%686fe507f9fd7ecd
09-15 12:09:05.895: V/GCMBroadcastReceiver(20289): GCM IntentService class: nl.vanvianen.android.gcm.GCMIntentService
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:
09-15 12:13:28.785: I/GCM(1534): GCM message [app_package] 0:1442312009285689%686fe507f9fd7ecd
09-15 12:13:29.465: V/GCMRegistrar(22499): Setting the name of retry receiver class to nl.vanvianen.android.gcm.GCMBroadcastReceiver
09-15 12:13:29.465: V/GCMBroadcastReceiver(22499): GCM IntentService class: nl.vanvianen.android.gcm.GCMIntentService
09-15 12:13:29.485: V/GCMBaseIntentService(22499): Intent service name: GCMIntentService--1
09-15 12:13:29.485: D/GCMIntentService(22499): (IntentService[GCMIntentService--1]) [29,390] Push notification received
09-15 12:13:29.495: D/GCMIntentService(22499): (IntentService[GCMIntentService--1]) [5,395] Message key: Type value: 1
09-15 12:13:29.495: D/GCMIntentService(22499): (IntentService[GCMIntentService--1]) [1,396] Message key: from value: 299548822026
09-15 12:13:29.495: D/GCMIntentService(22499): (IntentService[GCMIntentService--1]) [1,397] Message key: title value: Ajedrez Viladecans
09-15 12:13:29.495: D/GCMIntentService(22499): (IntentService[GCMIntentService--1]) [1,398] Message key: message value: ¡Tienes un nuevo cuestionario!
09-15 12:13:29.495: D/GCMIntentService(22499): (IntentService[GCMIntentService--1]) [1,399] Message key: channelID value: 6045
09-15 12:13:29.495: D/GCMIntentService(22499): (IntentService[GCMIntentService--1]) [2,401] Message key: collapse_key value: do_not_collapse
09-15 12:13:29.565: E/GCMIntentService(22499): (IntentService[GCMIntentService--1]) [67,468] Invalid setting priority, should be int, between PRIORITY_MIN (-2) and PRIORITY_MAX (2)
09-15 12:13:29.575: D/GCMIntentService(22499): (IntentService[GCMIntentService--1]) [5,473] Creating notification...
09-15 12:13:29.585: I/GCMIntentService(22499): (IntentService[GCMIntentService--1]) [16,489] Group: MyNotificationGroup
09-15 12:13:29.595: I/GCMIntentService(22499): (IntentService[GCMIntentService--1]) [7,496] LocalOnly: false
09-15 12:13:29.595: I/GCMIntentService(22499): (IntentService[GCMIntentService--1]) [1,497] Priority: 0
09-15 12:13:29.595: I/GCMIntentService(22499): (IntentService[GCMIntentService--1]) [2,499] Vibrate: true
09-15 12:13:29.595: I/GCMIntentService(22499): (IntentService[GCMIntentService--1]) [1,500] Insistent: false
from gcmpush.
Strange, you should see the Push notification received
message.
from gcmpush.
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.
from gcmpush.
Related Issues (20)
- Can't install the module HOT 2
- google.sent_time expected String -> crash HOT 8
- Error: Alloy is not defined HOT 1
- Module not compatible with SDK 5.4.0 ?? HOT 4
- FCM compatibility HOT 15
- registerPush called twice HOT 3
- compiled module HOT 2
- Titanium sdk 6.0.0 support? HOT 46
- Exception en Google Play Store
- Notification Push when app is closed and I want launch a specific function. HOT 1
- library "libstlport_shared.so" not found with 6.0.x sdks HOT 6
- Remove USE_CREDENTIALS from timodule.xml
- no compile sdK 6.1.1 HOT 10
- Click listener on notifications in android HOT 10
- Not support for Titanium sdk 6.3.0 ? HOT 2
- Failed to package application running version 1.6 and with titanium sdk 6.1.3
- Using Titanium SDK 7.0.0 GA and module version 2.0
- Support for Android O
- Android O crash
- Android notification does not appear in the android device notification center if the android:targetSdkVersion="26" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gcmpush.