Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (android)
Viewing all articles
Browse latest Browse all 7655

Android push notifation is not working

$
0
0
Hi, I am working android pushnotification, my device is registered in ACS but push is coming to my device if(Ti.Platform.osname == 'android') { var CloudPush = require('ti.cloudpush'); CloudPush.debug = true; // CloudPush.enabled = true; CloudPush.showTrayNotificationsWhenFocused = true; //CloudPush.focusAppOnPush = false; var deviceToken; try{ CloudPush.retrieveDeviceToken({ success: function deviceTokenSuccess(e) { deviceToken = e.deviceToken; alert('deviceToken! ' + deviceToken); Ti.API.info('deviceToken::@@@@: '+deviceToken); registerForAndroid(); //unSubCribeAndroidPush(deviceToken); }, error: function deviceTokenError(e) { alert('Failed to register for push! ' + e.error); } }); } catch(e) { alert('Error '+e.error); } function registerForAndroid(){ //alert('register'); Cloud.PushNotifications.subscribe({ channel: 'friend_request', //'alert' is channel name device_token: deviceToken, type: 'gcm' //here i am using gcm, it is recommended one }, function (e) { if (e.success) { CloudPush.setEnabled(true); setAndroiPushEnable(); alert('Subscribed for Push Notification!'); } else { alert('Subscribe error:'+e.message ); } }); }

Viewing all articles
Browse latest Browse all 7655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>