WiFi connection via android

23,837

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?

Share:
23,837
Yury Pogrebnyak
Author by

Yury Pogrebnyak

Updated on August 22, 2022

Comments

  • Yury Pogrebnyak
    Yury Pogrebnyak over 1 year

    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.

  • Yury Pogrebnyak
    Yury Pogrebnyak over 12 years
    Thanks, but what if I need my application to scan for available wifi networks and connect to the proper one, defined, f.e., by name? Can it be done "inside" my application?
  • Yury Pogrebnyak
    Yury Pogrebnyak over 12 years
    And the last question. I get IP address via wifiInfo.getIpAddress();, IP address here is int. How can I convert it to be able to use it in socket.open(host, port)? Here host is either String or InetAddress.