我正在尝试使用Azure移动服务和Apache Cordova的Visual Studio工具.(https://msdn.microsoft.com/en-gb/magazine/dn879353.aspx)
我想使用移动服务进行推送通知.我已经使用Node后端和TodoItem表创建了该服务.我也设置了GCM.
但是,在尝试注册模板时,我收到404 Not Found错误:
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); });
最后一行给了我404.我正在谷歌Android模拟器中运行该应用程序.
编辑:我尝试使用Postman调用注册终端:https://myservice.azure-mobile.net/push/registrations ? platform = gcm & deviceId =
如果我做了GET,我得到[]作为回复,如果我做了一个POST,我得到404