Phonegap和Parse.com推送通知IOS
因此,我正在尝试设置PhoneGap IOS和Parse.com推送通知应用程序。我正在使用这个插件向苹果注册设备,并取回设备令牌。现在,我需要在解析时将该数据保存到Installation类。问题是,当我进行保存时,它会创建一个新的安装类Phonegap和Parse.com推送通知IOS,ios,cordova,parse-platform,Ios,Cordova,Parse Platform,因此,我正在尝试设置PhoneGap IOS和Parse.com推送通知应用程序。我正在使用这个插件向苹果注册设备,并取回设备令牌。现在,我需要在解析时将该数据保存到Installation类。问题是,当我进行保存时,它会创建一个新的安装类 var Installation = Parse.Object.extend("Installation"); var installation = new Installation(); installation.save({badge:
var Installation = Parse.Object.extend("Installation");
var installation = new Installation();
installation.save({badge: status.pushBadge, deviceToken: status.deviceToken, deviceType: status.type, installationId: appID}, {
success: function(response){
alert("seccuees " + response);
},
error: function(error){
alert("error " + error.message);
}
});
我还尝试过使用对RESTAPI的ajax调用和NoGo
$.ajax({
type: 'GET',
headers: {'X-Parse-Application-Id':'miid','X-Parse-Rest-API-Key':'myid'},
url: "https://api.parse.com/1/installations",
data: {"deviceType": "ios", "deviceToken": "01234567890123456789", "channels": [""]},
contentType: "application/json",
success: function(response){
alert("Success " + response);
},
error: function(error){
alert("Error " + error.message);
}
});
如果要更新数据,请确保类型为“POST”而不是“Get”
$.ajax({
type: 'POST', // <============
headers: {'X-Parse-Application-Id':'miid','X-Parse-Rest-API-Key':'myid'},
url: "https://api.parse.com/1/installations",
data: {"deviceType": "ios", "deviceToken": "01234567890123456789", "channels": [""]},
contentType: "application/json",
success: function(response){
alert("Success " + response);
},
error: function(error){
alert("Error " + error.message);
}
});
$.ajax({
键入:“POST”,如果要更新数据,请确保键入的是“POST”而不是“Get”
$.ajax({
type: 'POST', // <============
headers: {'X-Parse-Application-Id':'miid','X-Parse-Rest-API-Key':'myid'},
url: "https://api.parse.com/1/installations",
data: {"deviceType": "ios", "deviceToken": "01234567890123456789", "channels": [""]},
contentType: "application/json",
success: function(response){
alert("Success " + response);
},
error: function(error){
alert("Error " + error.message);
}
});
$.ajax({
键入:“POST',//不要使用“Installation”类。它只会创建一个新的安装对象。若要为推送通知创建解析安装对象,请使用“\u Installation”。下面是执行此操作的方法
var installation = new Parse.Object("_Installation");;
installation.save({ channels: ['channelName'], deviceType: "android", installationId: id}, {
success: function(response){
alert("success " + response);
},
error: function(error){
alert("error " + error.message);
}
});
不要使用“Installation”类。它只会创建一个新的安装对象。若要为推送通知创建解析安装对象,请使用“\u Installation”。以下是操作方法
var installation = new Parse.Object("_Installation");;
installation.save({ channels: ['channelName'], deviceType: "android", installationId: id}, {
success: function(response){
alert("success " + response);
},
error: function(error){
alert("error " + error.message);
}
});
你能告诉我android的代码吗。