简体   繁体   中英

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. 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.

Is there a way for the web client to be the one initiating? 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. 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. 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 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]

Here you'll find how to implement the GCM with PHP.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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