I'm trying to get started with Azure Mobile Services and Visual Studio Tools for Apache Cordova. (https://msdn.microsoft.com/en-gb/magazine/dn879353.aspx)
I want to use the Mobile Service for push notifications. I've created the service, with a Node backend, and a TodoItem table. I've got a GCM set up too.
However, when trying to register a template, I get a 404 Not Found error:
var GCM_SENDER_ID = 'MY_GCM_ID';
mobileServiceClient = new WindowsAzure.MobileServiceClient(
"MY_URL",
"MY_API_KEY"
);
pushNotification = PushNotification.init({
"android": { "senderID": GCM_SENDER_ID }
});
pushNotification.on('registration', function (data) {
var handle = data.registrationId; //This appears to be set alright
var platform = device.platform; // This is 'Android'
if (platform == 'android' || platform == 'Android') {
var template = '{ "data" : {"message":"$(message)"}}';
mobileServiceClient.push.gcm.registerTemplate(handle, 'myTemplate', template, null);
});
The final line gives me a 404. I'm running the app in the Google Android Emulator.
EDIT: I tried calling the registrations endpoint using Postman: https://myservice.azure-mobile.net/push/registrations?platform=gcm&deviceId=
If I do a GET, I get [] as a response, if I do a POST, I get 404