Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WiFi connection via android

Tags:

java

android

wifi

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.

like image 857
Yury Pogrebnyak Avatar asked Dec 09 '11 09:12

Yury Pogrebnyak


People also ask

Can I use my smartphone as Wi-Fi?

To use your Android device as a mobile hotspot, open the Settings app and select Network & internet. Then go to Hotspot & tethering > Wi-Fi hotspot and enable Use Wi-Fi hotspot. Finally, connect another device to the WiFi network using the Hotspot name and password.

Can I use my Android phone as a Wi-Fi router?

You can use your phone's mobile data to connect another phone, tablet, or computer to the internet. Sharing a connection this way is called tethering or using a hotspot. Some phones can share Wi-Fi connection by tethering. Most Android phones can share mobile data by Wi-Fi, Bluetooth, or USB.

Why Wi-Fi is not connecting in my Android phone?

Restart your device. Open your Settings app and tap Network & internet or Connections. Depending on your device, these options may be different. Turn Wi-Fi off and mobile data on, and check if there's a difference. If not, turn mobile data off and Wi-Fi on and check again.

How can I share Wi-Fi from my phone?

If your guest has an Android phone, head to Settings, Connections (or Network and Internet), then Wi-Fi on their phone. Scroll down to find where it says Add Network; next to it, you'll see a QR code icon. Tap on it and they can now quickly scan the code. Scanning the code should automatically connect the device.


1 Answers

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?

like image 176
user370305 Avatar answered Oct 31 '22 09:10

user370305