Yesterday I was trying to implement the notification on my Titanium Alloy App, when server php script is run. Once it worked but don't know what happened thereafter no notification is coming on calling CURL request on my PHP server. Response is coming after Calling CURL to Android GCM Send
Sample response: id=0:1431949527356415%1ba0f8cc00000030
I have checked everything. 1. My server IP is listed in Google API aproved server. 2. Project ID is same (GCM_sender_id) 3. Api key is same given by Google, 4. Device token is correct
I wrote:
var gcm = require('net.iamyellow.gcmjs')
var pendingData = gcm.data;
if (pendingData && pendingData !== null) {
// if we're here is because user has clicked on the notification
// and we set extras for the intent
// and the app WAS NOT running
// (don't worry, we'll see more of this later)
Ti.API.info('******* data (started) ' + JSON.stringify(pendingData));
}
gcm.registerForPushNotifications({
success: function (ev) {
// on successful registration
Ti.API.info('******* success, ' + ev.deviceToken);
},
error: function (ev) {
// when an error occurs
Ti.API.info('******* error, ' + ev.error);
},
callback: function () {
// when a gcm notification is received WHEN the app IS IN FOREGROUND
alert('hellow yellow!');
},
unregister: function (ev) {
// on unregister
Ti.API.info('******* unregister, ' + ev.deviceToken);
},
data: function (data) {
// if we're here is because user has clicked on the notification
// and we set extras in the intent
// and the app WAS RUNNING (=> RESUMED)
// (again don't worry, we'll see more of this later)
Ti.API.info('******* data (resumed) ' + JSON.stringify(data));
}
});
The issue is, Device is generating token, i.e. goes to the success part, but is not coming now in callback
Please anyone knows the solution?