I am trying to subscribe cloud services using Titanium with Alloy.
I already configured the Google Cloud Messaging (GCM) API Key, and the ACM of my app, however in the cload.appcelarator.com push notifications sections appears: "Send a push notification to your subscribed devices. You currently have 0 iOS clients, 0 Android clients subscribed to push notifications. Any thoughts of this?
" This is the code with I'm testing with:
index.js
var CloudPush = require('ti.cloudpush');
CloudPush.retrieveDeviceToken({
success: function deviceTokenSuccess(e) {
// Use this device token with Ti.Cloud.PushNotifications calls
// to subscribe and unsubscribe to push notification channels
Ti.API.info('Device Token: ' + e.deviceToken);
},
error: function deviceTokenError(e) {
alert('Failed to register for push :(! ' + e.error);
}
});
// These events monitor incoming push notifications
CloudPush.addEventListener('callback', function (evt) {
alert(evt.payload);
});
CloudPush.addEventListener('trayClickLaunchedApp', function (evt) {
Ti.API.info('Tray Click Launched App (app was not running)');
});
CloudPush.addEventListener('trayClickFocusedApp', function (evt) {
Ti.API.info('Tray Click Focused App (app was already running)');
});
$.index.open();
Thank you very much for any advise or help.
0 comments:
Post a Comment