Cordova push notifications - invalid action

Hi

I am using Cordova by apache (https://cordova.apache.org) which is a html5 js based framework for android . Ive managed to get push working with other vendors .

I have made some success using code i found in the js file .When i send the google reg id through i get a failed to register with the invalid action response from your service .the logcat output is below . If you could advise what I am doing wrong i would be grateful .

I created a modified version of the register device function and called it registerdeviceandroid ,i see it already had placeholders for the data that i needed to give to you for notifications .

registerDevice: function (channels, expiration, async) {
var responder = extractResponder(arguments);
var isAsync = responder != null;
var device = isBrowser() ? window.device : NodeDevice;
var data = {
deviceToken: null, //This value will set in callback
deviceId: device.uuid,
os: device.platform,
osVersion: device.version
};
if (Utils.isArray(channels)) {
data.channels = channels;
}
for (var i = 0, len = arguments.length; i < len; ++i) {
var val = arguments;
if (Utils.isNumber(val) || val instanceof Date) {
data.expiration = (val instanceof Date) ? val.getTime() / 1000 : val;
}
}
var url = this.restUrl + ‘/registrations’;
var success = function (deviceToken) {
data.deviceToken = deviceToken;
Backendless._ajax({
method: ‘POST’,
url: url,
data: JSON.stringify(data),
isAsync: isAsync,
asyncHandler: responder
});
};
var fail = function (status) {
console.warn(JSON.stringify(['failed to register ', status]));
};
var config = {projectid: “http://backendless.com”, appid: Backendless.applicationId};
cordova.exec(success, fail, “PushNotification”, “registerDevice”, [config]);
},registerDeviceAndroid: function (channels, expiration, async,tok,devid,os,osv) {
var responder = extractResponder(arguments);
var isAsync = responder != null;
var device = isBrowser() ? window.device : NodeDevice;
var data = {
deviceToken: tok, //This value will set in callback
deviceId: devid,
os: “ANDROID”,
osVersion: “5”
};

        var url = this.restUrl + '/registrations';
        var success = function (deviceToken) {
            data.deviceToken = deviceToken;
            Backendless._ajax({
                method: 'POST',
                url: url,
                data: JSON.stringify(data),
                isAsync: isAsync,
                asyncHandler: responder
            });
        };
        var fail = function (status) {
            console.warn(JSON.stringify(['failed to register ', status]));
        };
        var config = {projectid: "http://backendless.com", appid: Backendless.applicationId};
        cordova.exec(success, fail, "PushNotification", "registerDevice", [config]);
    },

Does Anyone Read these?

Sorry, I missed this one. The code in backendless.js for device registration is not currently used and not documented. It is rather old and I do not recommend using it as an example.

You can see device registration for REST clients at:

https://backendless.com/documentation/messaging/rest/messaging_device_registration.htm

Regards,
Mark

what should be the value for the deviceToken?
We gave some arbitary value and it got registered

The token is from google cloud messaging. its unique per device.

Thanks Mark,

I will look into this if i get another client that plans to use your service,