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

Invalid Sender Using Push in acs android

$
0
0

Hi

I am trying push on android using acs.As far as i think i am using the right sender id and project key but it keeps on saying INVALID SENDER.i have tested and created new api keys again and again but no benefit.Could you plz tell me what could be the problem because even iOS push is working fine.Here is my code

var deviceToken;
var CloudPush = require('ti.cloudpush');
 
//fetch device token
CloudPush.retrieveDeviceToken({
    success : function deviceTokenSuccess(e) {
        deviceToken = e.deviceToken;
        loginUser();
        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;
function loginUser() {
    Cloud.Users.login({
        login : 'push',
        password : 'push'
    }, function(e) {
        if (e.success) {
            Ti.API.error("Login success");
            defaultSubscribe();
        } else {
            Ti.API.error('Login error: ' + ((e.error && e.message) || JSON.stringify(e)));
        }
    });
}
 
function defaultSubscribe() {
    Cloud.PushNotifications.subscribe({
        channel : 'alert', //'alert' is channel name
        device_token : deviceToken,
        type : 'gcm' //here i am using gcm, it is recomended one
    }, function(e) {
        if (e.success) {
            Ti.API.error('Subscribed for Push Notification!');
        } else {
            Ti.API.error('Subscrib error:' + ((e.error && e.message) || JSON.stringify(e)));
        }
    });
}
 
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)');
});

Thanks


Viewing all articles
Browse latest Browse all 7655

Trending Articles



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