如何将通道分配给Parse Object。实际上我正在尝试为要安装应用程序的每个设备分配不同的通道,这样每个安装设备都会分开。我试图搜索教程我是parse的新手。每个用PF对象描述通道。我不知道这是什么。我只知道ParseObject。如何将通道分配给一个解析对象。如果我有这样的声明:
ParseObject pObject=new ParseObject("Rotator");
我的发送数据方法代码:
po = new ParseObject("LatLang");
po.put("imei_code", imei_code_of_device);
po.put("latitude", Double.toString(loc.getLatitude()));
po.put("longitude", Double.toString(loc.getLongitude()));
po.saveInBackground();
MyRecieving数据代码方法:
po=new ParseObject("LatLng");
ParseQuery<ParseObject> query = ParseQuery.getQuery("LatLang");
query.whereEqualTo("imei_code", "357146054169800");
query.orderByDescending("updatedAt");
query.getFirstInBackground(new GetCallback<ParseObject>() {
@Override
public void done(ParseObject objectLatest, ParseException e) {
if (e == null) {
lat = objectLatest.getString("latitude");
lang = objectLatest.getString("longitude");
e1.setText(lat);
e2.setText(lang);
e3.setText(objectLatest.getObjectId().toString());
Toast.makeText(
getApplicationContext(),
"Found the New Location:\nLatitude:" + lat
+ "\nLongitude:" + lang + "\nObjectID:"
+ objectLatest.getObjectId().toString(),
Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(),
"Error was found\n" + e, Toast.LENGTH_LONG).show();
Log.d("item", "Error: " + e.getMessage());
}
}
});
答案 0 :(得分:0)
ParsePush.subscribeInBackground(phoneNumber);
答案 1 :(得分:0)
ParsePush pushData = new ParsePush();
po = new ParseObject("LatLang");
po.put("imei_code", imei_code_of_device);
po.put("latitude", Double.toString(loc.getLatitude()));
po.put("longitude", Double.toString(loc.getLongitude()));
po.saveInBackground(new SaveInCallBack(){
pushData .setChannel("your channel name");
pushData .sendInBackGorund();
});