• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

android receive and send data through wifi connection

 
Greenhorn
Posts: 22
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All!!!
Actually I want to send data from a hardware piece to an android device.
The hardware device is connected to local wireless router which is connected to modem.
Android device will also connected to same router through wi fi.
Can you please suggest some links or tutorial from where i can get idea how to establish communication between hardware device an the android device to send and receive data through wi-fi
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The usual way would be for the mobile device to start the communication. It would somehow need to determine the IP address of the "hardware device", which should be fixed (if it's not fixed things rather more complicated). Once the IP address is known, the Android device can use whatever TCP/IP protocol the hardware device happens to understand.
 
NeelNisha Singh
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for reply

Here I am having a custom hardware which will be having inbuilt wi-fi and it will act as a wireless access point which will
allow wireless devices (android phone)to connect to a wired network using Wi-Fi
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm confused. You said the Android device was connected via Wifi to the same network as the "hardware device". Now you're saying that it is actually this hardware device which will make this Wifi connection possible? So it is a Wifi base station? If so, doesn't it come with everything needed to let devices make a connection to it built in? Or is it a custom thingie you're in the process of building?
 
NeelNisha Singh
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes we are in process of making that hardware device which will be having inbuilt wi-fi,and will act as wireless access point
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you're asking how to connect to a Wifi network? If so, the android.net.wifi.WifiManager class has everyting you need. Although I'm not clear why the app would want to deal with that itself. If you're asking something else, please provide more detail on what that is.
 
NeelNisha Singh
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually aim is like to control Air conditioner devices on individual user basis instead of remote control user will be able to control Air conditioner parameters through Android device,
So the hardware device which is connected to Air conditioner will be having inbuilt wi-fi ,and Android device will get data and send data through wi-fi from that hardware.
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So then the answer is what Ulf said first: the device needs an ip address or name the android phone can use to find the device. It will also need to have some protocol for communicating - for example a small OS that runs a web service or the like.

One protocol I have used for this sort of thing is MQTT (MQTT.org). It is a simple protocol used in 'the internet of things' that lets devices (like your air conditioner) send and receive information based on topics. You have an MQTT broker installed on a computer, have the air conditioner and the phone connect to the broker then have fixed topics where the air conditioner publishes its settings and current temp. Then a different set of topics the air conditioner listens to for changing those settings. The phone subscribes to the current settings and the temperature and can give the user the ability to change the settings using the second set of topics. It is flexible, and gives you room to add multiple air conditioners or other appliances without having to connect to multiple servers/ip addresses. For the broker Mosquitto (mosquitto.org) works well and for Android the Java-based Paho client code works well (eclipse.org/paho/).

But that is just one way. There are many options to choose from and what you choose to do on the hardware will narrow your options for the android device.
 
reply
    Bookmark Topic Watch Topic
  • New Topic