Broadcast message from Desktop PC to Android Devic

2019-04-15 19:10发布

问题:

I want to transfer messages/file from desktop application to the Android device. My question is that can I connect desktop Wifi device with the Android WiFi device without any use of internet connection. I want to use it just like Bluetooth. Is this possible/feasible or not? If it is possible then how can I implement it? And what is the message limit to transfer message/file?

Note : I wanted to use it as real time application.

Kindly suggest me any good approach and if possible then how to do that.

Thanks and Regards Dhaval

回答1:

Wifi Direct will solve your problem, but there are no public API's available yet for developers. You will have to wait until Google releases it (hopefully soon). Some more reading:

http://www.sfonge.com/forum/topic/when-will-android-open-wi-fi-direct-api http://groups.google.com/group/android-developers/browse_thread/thread/eb62f0aa0eccf161



回答2:

Have a look at the Android Notifier application and it's sourcecode.



回答3:

If you either convince your PC to function as a wireless access point, or obtain a wireless access point, you can set up a network connection between the PC and an unmodified android device. Note that it is not necessary for their to be an upstream Internet connection feeding the PC or access point.

You would then need to write a server running on the phone which listens for inbound TCP connections from the PC. Any android application with internet permission can do this, provided that you use a port number in the unprivileged range. You may have problems with the wifi timing out and shutting down, so you may need to use a timer to periodically trigger a small network operation (ping the access point, etc) to keep it awake. Note that this will use up your battery (what android wants to shut down an idle wifi to prevent).

If you can get both the device and the PC to work with an "ad-hoc" wireless connection you would not need the access point or PC to function as one, however last I heard this required root-level mods to the android device.



标签: android wifi