我想通过 Parse.com 使用我的应用程序将推送通知从一台 android 设备发送到另一台设备。
I want to send push notification from one android device to another using my application by Parse.com.
我想制作一个应用程序,一个用户可以在其中寻求帮助,而所有其他使用该应用程序的用户都会收到该通知。我为此使用 Parse.com 作为服务器。我对此完全陌生,请帮助 me.I 通过密钥等注册我的设备。现在我可以从 parse.com 向我的设备发送推送通知。
但不知道如何在我的设备上将其发送到其他设备?
您可以创建订阅设备到不同的唯一频道名称,然后您可以使用其他设备订阅的频道向设备发送包含所需负载的通知。
//subscribing to channel
ParsePush.subscribeInBackground("Channel_Name");
//getting installed devices
ParseQuery pushQuery = ParseInstallation.getQuery();
//query for getting devices with channel name
pushQuery.whereEqualTo("channels", "Channel_Name");
ParsePush push = new ParsePush();
push.setQuery(pushQuery);
push.setMessage("Your message payload");
push.sendInBackground();
您可以为多个设备订阅同一个频道,但在这种情况下,当发送通知时,它会被发送到所有订阅了特定频道的设备。
更多信息:https://parse.com/docs/android/guide#push-notifications
我想制作一个应用程序,一个用户可以在其中寻求帮助,而所有其他使用该应用程序的用户都会收到该通知。我为此使用 Parse.com 作为服务器。我对此完全陌生,请帮助 me.I 通过密钥等注册我的设备。现在我可以从 parse.com 向我的设备发送推送通知。
但不知道如何在我的设备上将其发送到其他设备?
您可以创建订阅设备到不同的唯一频道名称,然后您可以使用其他设备订阅的频道向设备发送包含所需负载的通知。
//subscribing to channel
ParsePush.subscribeInBackground("Channel_Name");
//getting installed devices
ParseQuery pushQuery = ParseInstallation.getQuery();
//query for getting devices with channel name
pushQuery.whereEqualTo("channels", "Channel_Name");
ParsePush push = new ParsePush();
push.setQuery(pushQuery);
push.setMessage("Your message payload");
push.sendInBackground();
您可以为多个设备订阅同一个频道,但在这种情况下,当发送通知时,它会被发送到所有订阅了特定频道的设备。
更多信息:https://parse.com/docs/android/guide#push-notifications