简体   繁体   English

如何从设备上运行的Android应用程序向另一个运行相同应用程序的设备发送推送通知?

[英]how to send a push notification from an android app running on a device to another device running the same app?

I am new to android and am making a simple app for my college project. 我是Android新手,正在为我的大学项目制作一个简单的应用程序。 The app runs on a simple concept wherein a faculty can know his/her examination duties(which room number is allocated to her for invigilating)and can thus register and login on the app. 该应用程序以一个简单的概念运行,在该概念中,教师可以知道他/她的检查职责(分配给她的房间号以进行授课),因此可以在该应用程序上注册和登录。 After logging in, he/she will receive a room number. 登录后,他/她将收到一个房间号。 He/she can get a list of all other faculties with their respective duties. 他/她可以获取所有其他学院及其职责的清单。

Now I want to add another service which will allow a faculty to send a notification to another faculty using the app for swapping room duties. 现在,我想添加另一项服务,该服务将允许教师使用该应用程序向另一位教师发送通知以交换房间职责。 When sent, another faculty receives a push notification over the net on their app. 发送后,另一位教师会在其应用程序上通过网络接收推送通知。

I am reading about google gcm but cannot find a solution. 我正在阅读有关google gcm的信息,但找不到解决方案。

Thanks in advance. 提前致谢。

First, you must register your app on GCM, GCM will give you a regID with one device. 首先,您必须在GCM上注册您的应用,GCM会通过一个设备为您提供regID And you must have a server side, the server side stores all regIDs. 并且您必须具有服务器端,该服务器端存储所有regID。 When you need to push a notification for the other devices, you send a request to your server side, the server side will send a request to GCM with the regIDs (depend on you) then GCM will push notification to all devices. 当您需要向其他设备推送通知时,您会向服务器端发送请求,服务器端会使用regID(取决于您)向GCM发送请求,然后GCM会将通知推送至所有设备。 The workflow: 工作流程:
1. Your phone app will register on GCM, take a regID. 1.您的电话应用将在GCM上注册,并使用regID。 Your server side saves this regID. 您的服务器端将保存此regID。
2. You will send a request to your server side. 2.您将向服务器端发送请求。 The server side will use this request to make another request include all or some regIDs, and send this request to GCM. 服务器端将使用此请求使另一个请求包含所有或某些regID,并将此请求发送到GCM。
3. GCM will take regIDs from the request, and push notification to the device which have regID match with one of regID in the request. 3. GCM将从请求中获取regID,并将通知与请求中的regID之一匹配的设备推送到设备。
For more details, please read this: https://developers.google.com/cloud-messaging/gcm 有关更多详细信息,请阅读以下内容: https : //developers.google.com/cloud-messaging/gcm

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否可以使用推送通知使用运行同一应用程序的其他设备终止活动 - Is it possible to kill an activity using another device running the same app using Push Notification 将android中的推送通知从设备发送到另一个 - send push notification in android from device to another Android应用未在设备上运行 - Android app is not running on device 如何使用解析从一个Android设备向另一个Android设备发送推送通知? - How to send push notification from one android device to another android device using parse? 如何使用电话号码将通知从Android应用发送到另一个Android设备? - How to send a notification from an android app to another android device using phone number? 当应用未运行时,Android设备未响应远程推送通知而显示警报 - Android device not showing alert in response to remote push notification when the app is not running 设备上没有通知,但应用程序中有通知-Android推送通知 - no notification on device but there is notification in app -Android push notifications 如何将通知从一个Android设备发送到同一wifi网络中的另一个Android设备 - How to send notification from one android device to another android device in same wifi network 如何从推送通知启动后台运行 Android 应用程序? - how to launch background running android app from push notification? 在Android中的另一台设备中将通知从一个应用发送到另一个应用 - Sending notification from one app to another app in another device in Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM