Parse platform 使用Parse push作为独立服务

Parse platform 使用Parse push作为独立服务,parse-platform,push,Parse Platform,Push,我正在构建iOS和Android应用程序(两个应用程序)。 我正在寻找一个替代城市飞艇,我不再信任。主要是 因为我到处都看不到价格 我想使用Parse Push作为一个独立的产品。这可能吗? 我不想使用任何其他解析功能。正如在 是的,你可以。当然,您需要包括parse sdk,因为您需要通过parse系统注册设备。因此: 注册设备以接收推送通知后(iOS示例) 通过iOS发送推送通知 PFPush*pushObj=[[PFPush alloc]init]; NSString*destDevice

我正在构建iOS和Android应用程序(两个应用程序)。 我正在寻找一个替代城市飞艇,我不再信任。主要是 因为我到处都看不到价格

我想使用Parse Push作为一个独立的产品。这可能吗?
我不想使用任何其他解析功能。

正如在

是的,你可以。当然,您需要包括parse sdk,因为您需要通过parse系统注册设备。因此:

注册设备以接收推送通知后(iOS示例)

通过iOS发送推送通知

PFPush*pushObj=[[PFPush alloc]init];
NSString*destDeviceToken=@;
//通过通道,您可以唯一地标识用于多播的设备或设备组
//推送通知(假设您的计算机上有多个安装
//解析数据库(保留相同的通道名称)。
//在本例中,我们使用
//唯一唯一的deviceToken
[pushObj设置通道:@[destDeviceToken];
//推送结构消息
[pushObj setData:@{@“我的消息!!”,@“警报”}];
//发送推送(因此,发送到处理推送通知的解析服务器)
//为您请求并交付)
[pushObj sendPushInBackground];
通过Android发送推送通知

字符串destDeviceToken=”“;
JSONObject数据=新的JSONObject(“{\”警报\“:\”我的消息!!\“}”);
ParsePush*push=新的ParsePush();
推送设置频道(destDeviceToken);
push.setData(数据);
push.sendPushInBackground();
通过Javascript发送推送通知(云代码) (需要在解析的云代码上实现)

var destDeviceToken='';
Parse.Push.send({
频道:[destDeviceToken],
数据:{
提醒:“我的留言!!”
}
}, {
成功:函数(){
//推送成功
},
错误:函数(错误){
//处理错误
}
});
通过REST呼叫发送推送通知 (它允许您在不进行解析的情况下执行发送推送通知,因此可以从支持REST调用的任何其他平台执行)

curl-X POST\
-H“X-Parse-Application-Id:”\
-H“X-Parse-REST-API-Key:”\
-H“内容类型:应用程序/json”\
-d'{
“频道”:[
""
],
“数据”:{
“警报”:“我的消息!!”,
}
}' \
https://api.parse.com/1/push
这样,您就不需要任何额外的实现,比如注册用户之类的

希望有帮助

- (void)application:(UIApplication *)application
        didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    // Store the deviceToken in the current Installation and save it to Parse.
    PFInstallation *deviceInstallation = [PFInstallation currentInstallation];
    [deviceInstallation setDeviceTokenFromData:deviceToken];
    // this will be used later for sending push notifcations to this device       
    [deviceInstallation setChannels:@[deviceToken]]; 
    [deviceInstallation saveInBackground];
}
PFPush *pushObj = [[PFPush alloc] init];
NSString* destDeviceToken = @"<DESTIONATION DEVICE TOKEN>";

// Through channels, you can uniquely identify devices or group of them for multicast 
// push notification (imagine that more than one installation on your 
// Parse database keep the same channel name). 
// In this case we have set the channel name for each installation with the 
// only unique deviceToken
[pushObj setChannels:@[destDeviceToken]];

// Push structure message
[pushObj setData:@{@"My Message!!",@"alert"}];

// send push ( so, send to parse server that handle the push notification 
// request and deliver it for you)
[pushObj sendPushInBackground];
String destDeviceToken = "<DESTIONATION DEVICE TOKEN>";
JSONObject data = new JSONObject("{\"alert\": \"My Message!!\"}");     
ParsePush *push = new ParsePush();
push.setChannel(destDeviceToken);
push.setData(data);
push.sendPushInBackground();
var destDeviceToken = '<DESTIONATION DEVICE TOKEN>';
Parse.Push.send({
  channels: [ destDeviceToken ],
  data: {
    alert: "My Message!!"
  }
}, {
  success: function() {
    // Push was successful
  },
  error: function(error) {
    // Handle error
  }
});
curl -X POST \
  -H "X-Parse-Application-Id: <YOUR PARSE APP ID>" \
  -H "X-Parse-REST-API-Key: <YOUR REST API KEY>" \
  -H "Content-Type: application/json" \
  -d '{
        "channels": [
          "<DESTIONATION DEVICE TOKEN>"
        ],
        "data": {
          "alert": "My Message!!",
        }
      }' \
  https://api.parse.com/1/push