简体   繁体   中英

How can we send message to the android device from a browser of PC (both connected with same network)

The main requirement which need to got is

Suppose I have a PC and have an Android Device. Now if my android app is open in my android device and i hit the url http://192.0.0.1?save=111 on browser of PC and when i hit i can get the value 111 in My App . Where 192.0.0.1 is IP address of android device.

For you to be able to link a url to your app you will first need a small http server embedded on your app . NanoHttpd can easily be embedded. Here you can find an android app example.

The best strategy is to use Messaging protocols for that, for android you can use MQTT
Your browser will be accessing the MQTT sever, your android device will be running an MQTT client
Once all above is complete, you can send messages from your browser and your android device will receive the message almost instantaneously.
Read more about about MQTT here http://mqtt.org/

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