WiFi connection via android

别说谁变了你拦得住时间么 提交于 2019-12-18 11:36:07

问题


I need a tutorial on how to process data on android via wifi. F.e., I need to send some message to PC and receive some other message. How should I establish the connection? What should I do to be able to transfer data and how?

Sorry for the dummy question, but I can't find good manual. I'll be grateful for as detailed manual as possible, or for ome simple example on etablishing wifi connection and sending/receiving simple mesages.


回答1:


You don't have to use any API for connect to wifi its only requires if you want to manually start your wifi in device,

Just make sure your device has a WiFi enable, and make a simple TCP/IP Socket application. With this you can communication with your system and device, And Use System's public IP to connect with your system.

Also don't forget to give permission Internet in your manifest file..

Here some nice links for Socket Programing in Android..

Simple connection example part II - TCP communication

Networking with Android

Simple communication using java.net.Socket

http://www.anddev.org/tcp_sockets-t276.html

http://www.anddev.org/socket_programming-t325-s30.html

EDIT:: Android WiFi examples,

Scan for Wireless Networks

Using WiFi API

SO Question Android: Is there any way to get notified when known wifi networks get in/out of range?



来源:https://stackoverflow.com/questions/8443245/wifi-connection-via-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!