简体   繁体   English

如何使用电话号码将通知从Android应用发送到另一个Android设备?

[英]How to send a notification from an android app to another android device using phone number?

I am developing an android application and i need to send a notification from the app to a phone number (another device). 我正在开发一个android应用程序,我需要从该应用程序向电话号码(另一台设备)发送通知。

Can anyone tell me how can i implement this? 谁能告诉我该如何实施? any methods or API i can use? 我可以使用任何方法或API吗?

Thank you in advance 先感谢您

I don't think you can do it without developing server-side software that Android devices will connect to. 我认为,如果不开发可将Android设备连接到的服务器端软件,就无法做到。 In your server-side software you can use FCM(Firebase Cloud Messaging) or any other framework/library to send notifications to one or group of devices. 在服务器端软件中,您可以使用FCM(Firebase云消息传递)或任何其他框架/库将通知发送到一个或一组设备。

Problem is that you need to have connection to the other device and you can't know if that device is connected to internet and even if it is you don't know the address of that device. 问题是您需要连接到另一台设备,并且您不知道该设备是否已连接到互联网,即使您不知道该设备的地址也是如此。 99.99% that you need server-side software. 您需要99.99%的服务器端软件。

the easiest way (but the most expensive i guess) is to have the first device send a request to a server (whose backend you have to build, eg. php) that will send a push notification to the second device via Google Cloud messaging service. 最简单的方法(但我猜是最昂贵的)是让第一台设备向服务器(您必须构建其后端的主机,例如php)发送请求,该服务器将通过Google Cloud消息服务向第二台设备发送推送通知。

that's not so easy because the second device to receive the notification must register at GCM and the first device must identificate the id of this device (the common way is to have a common id like username) 这不是那么容易,因为要接收通知的第二台设备必须在GCM上注册,并且第一台设备必须标识该设备的ID(常见方式是使用用户名之类的通用ID)

There is on possibility without using server side code, Send SMS to the second Phone and read the SMS in second phone and display your notification in second phone. 有可能不使用服务器端代码,而是将SMS发送到第二部手机并在第二部手机中读取SMS并在第二部手机中显示您的通知。 It will cost the SMS charges in both phones. 两部手机都将收取短信费用。

Create an API that communicates with the users of the application this will be able to send updates to the registered users at real-time. 创建一个与应用程序用户通信的API,它将能够实时将更新发送给注册用户。 http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/ http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/

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

相关问题 如何从我的应用程序向其他Android设备发送短信 - How to send SMS message to another android device from my app Android使用GCM和PHP将通知从设备发送到其他设备 - Android send notification from device to other device using GCM and PHP 如何使用GCM从Java服务器向Android应用程序发送通知? - How to send notification to Android app from Java server using GCM? 如何通过Java服务器使用FCM向Android设备发送推送通知? - how to send push notification to the android device using FCM by java server? 如何通过java服务器使用GCM向Android设备发送推送通知? - how to send push notification to the android device using GCM by java server? 在设备上安装App后的Android通知 - 如何? - Android Notification after App is installed on device - How to? 来自具有android 7.0的另一个应用程序的组通知 - Group notification from another app with android 7.0 从Java服务器向服务器发送推送通知 - Send push notification from server to android device in Java 如何使用Java在Windows Phone应用中发送推送通知? - How to send a push notification in windows phone app using java? 如何触发gcm向Android设备发送推送通知(使用Java服务器) - how to trigger a gcm to send a push notification to android device(using java server)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM