I have an app that subscribes to a chanel in app console to send push notification, but when I send one it says in the push log, fail. The device key is shown in the app console correctly.
Here's my code
Titanium.UI.setBackgroundColor('#000'); var deviceToken; var win = Ti.UI.createWindow({ backgroundColor : '#ccc', title : 'Android Cloud Push Notification' }); var CloudPush = require('ti.cloudpush'); //fetch device token CloudPush.retrieveDeviceToken({ success : function deviceTokenSuccess(e) { deviceToken = e.deviceToken; alert('Device Token: ' + deviceToken); Ti.API.info('Device Token: ' + e.deviceToken); }, error : function deviceTokenError(e) { alert('Failed to register for push! ' + e.error); } }); CloudPush.debug = true; CloudPush.enabled = true; CloudPush.showTrayNotificationsWhenFocused = true; CloudPush.focusAppOnPush = false; var Cloud = require('ti.cloud'); Cloud.debug = true; var submit = Ti.UI.createButton({ title : 'Register For Push Notification', color : '#000', height : '53dp', width : '200dp', top : '100dp' }); win.add(submit); submit.addEventListener('click', function(e) { loginDefault(); }); function loginDefault(e) { //Create a Default User in Cloud Console, and login with same credential Cloud.Users.login({ login : 'push123', password : 'push123' }, function(e) { if (e.success) { alert("Login success"); defaultSubscribe(); } else { alert('Login error: ' + ((e.error && e.message) || JSON.stringify(e))); } }); } function defaultSubscribe() { Cloud.PushNotifications.subscribe({ channel : 'alert2',//'alert' is channel name device_token : deviceToken, type : 'android' //here i am using gcm, it is recomended one }, function(e) { if (e.success) { alert('Subscribed for Push Notification!'); } else { alert('Subscrib error:' + ((e.error && e.message) || JSON.stringify(e))); } }); } CloudPush.addEventListener('callback', function(evt) { alert(evt.payload); alert('mensaje'); }); 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)'); }); win.open();The app says login success.
But when I send the notification the console shows this:
[WARN] : IInputConnectionWrapper: getExtractedText on inactive InputConnection [WARN] : IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection [WARN] : IInputConnectionWrapper: getExtractedText on inactive InputConnection [WARN] : IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection [WARN] : IInputConnectionWrapper: getSelectedText on inactive InputConnection [WARN] : IInputConnectionWrapper: getTextAfterCursor on inactive InputConnection [WARN] : IInputConnectionWrapper: getExtractedText on inactive InputConnection [WARN] : IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection [WARN] : IInputConnectionWrapper: getSelectedText on inactive InputConnection [WARN] : IInputConnectionWrapper: getTextAfterCursor on inactive InputConnection [WARN] : IInputConnectionWrapper: beginBatchEdit on inactive InputConnection [WARN] : IInputConnectionWrapper: endBatchEdit on inactive InputConnection [WARN] : IInputConnectionWrapper: getExtractedText on inactive InputConnection [WARN] : IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection [WARN] : IInputConnectionWrapper: getSelectedText on inactive InputConnection [WARN] : IInputConnectionWrapper: getTextAfterCursor on inactive InputConnection [WARN] : IInputConnectionWrapper: beginBatchEdit on inactive InputConnection [WARN] : IInputConnectionWrapper: endBatchEdit on inactive InputConnection [INFO] : TiAnalyticsSvc: (Thread-10579) [68025,832416] Analytics Service Started [INFO] : I/System.out: Thread-10579 calls detatch() [INFO] : TiAnalyticsSvc: (Thread-10579) [3165,835581] Stopping Analytics Service [INFO] : TiAnalyticsSvc: (Thread-10580) [55453,891034] Analytics Service Started [INFO] : I/System.out: Thread-10580 calls detatch() [INFO] : TiAnalyticsSvc: (Thread-10580) [1136,892170] Stopping Analytics Service [INFO] : Choreographer: Skipped 44 frames! The application may be doing too much work on its main thread. [INFO] : TiAnalyticsSvc: (Thread-10581) [98983,991153] Analytics Service Started [INFO] : I/System.out: Thread-10581 calls detatch() [INFO] : TiAnalyticsSvc: (Thread-10581) [1901,993054] Stopping Analytics Service [WARN] : IInputConnectionWrapper: showStatusIcon on inactive InputConnection [WARN] : IInputConnectionWrapper: getExtractedText on inactive InputConnection [INFO] : TiAnalyticsSvc: (Thread-10582) [60679,1053733] Analytics Service Started [INFO] : I/System.out: Thread-10582 calls detatch() [INFO] : TiAnalyticsSvc: (Thread-10582) [1315,1055048] Stopping Analytics Service
Please help!