简体   繁体   English

从Web客户端向Android应用发送数据

[英]Send data to android app from web client

I'm trying to make it such that a click on my web client from a computer can "trigger" the android app to run its set function. 我正在尝试使其从计算机上单击我的Web客户端可以“触发” Android应用程序以运行其设置功能。 I've searched extensively but it seems like all methods need the mobile device to initiate a connection before the web server can even do anything. 我进行了广泛的搜索,但似乎所有方法都需要移动设备在Web服务器甚至无法执行任何操作之前启动连接。

Is there a way for the web client to be the one initiating? Web客户端是否有办法成为发起者? Also, is there any way to do this without notifying the user of the device, ie in the background? 另外,有没有办法在不通知设备用户的情况下(即在后台)执行此操作? I'm using cakephp for the web client but any kind of answer will be appreciated. 我正在将Cakephp用于Web客户端,但是任何形式的回答都将不胜感激。 Thanks! 谢谢!

Use push notification system to trigger any action on your device. 使用推送通知系统触发设备上的任何操作。 Push notification system such as Parse , PushApps , pubnup etc are available for free and some are paid too. 推送通知系统(例如ParsePushAppspubnup等)是免费提供的,有些也是付费的。 Try them. 试试看 Send a push notification and listen to that push message and on receiving trigger your action. 发送推送通知并收听该推送消息,并在收到后触发您的操作。

Use Google Cloud Messaging . 使用Google Cloud Messaging

"Google Cloud Messaging for Android (GCM) is a service that allows you to send data from your server to your users' Android-powered device, and also to receive messages from devices on the same connection. The GCM service handles all aspects of queueing of messages and delivery to the target Android application running on the target device. GCM is completely free no matter how big your messaging needs are, and there are no quotas."[Google] “ Android的Google Cloud Messaging(GCM)是一项服务,它使您可以将服务器中的数据发送到用户的Android设备,也可以从同一连接上的设备接收消息。GCM服务处理排队的所有方面消息并传送到目标设备上运行的目标Android应用程序。无论您的消息传递需求有多大,而且没有配额,GCM都是完全免费的。” [Google]

Here you'll find how to implement the GCM with PHP. 在这里,您将找到如何使用PHP实施GCM。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM