ashish-kshirsagar / RaspberryPiHomeAutomation

Raspberry Pi and android home automation project
3 stars 1 forks source link

Controlling devices connected to raspberry pi remotely using an android app #1

Open HenryRalph opened 9 years ago

HenryRalph commented 9 years ago

Hi Friend, I am building a home automation project for my Final Masters project. I have the hardware components working using python and nodejs. The remaining part is to control these components remotely from my android using an android application that I want to develop. But the thing is that I don't know how to start. I went through your documentation and video to actually understand how you got it working but it wasn't explanatory. Now my question is:

  1. Do I have to install any thing into my raspberry pi for it to recognize my application's commands?
  2. What are the APIs I need to import into the java code on the android development part for this to be possible?
  3. What line of Code do I need to write for this communication to occur?

Please I will really appreciate any help. Thanks.

ashish-kshirsagar commented 9 years ago

Hi dazilli, Sorry to reply late... but let me know if you are still looking to find the solution and I will explain as I could. I will try to explain a generic solution below

There are multiple approaches to communicate with RPi using andorid phones as explained below

  1. Write your own web application - You can open website/ web application from any android or iPhone to access the website and control RPi. I believe as you are aware of Python and nodejs, this may be a comfortable approach for you.
  2. Writing web services and website - You can write web services REST / SOAP on RPi and website on your home server or any other cloud server. You can then open this website from any phone and control RPi. Point to note, this approach is pretty much similar to approach 1, with additional web services to access RPi.
  3. Writing your own TCP / UDP server - In this approach you need to write andorid/iPhone apps to be installed on the device you using. You also need to write TCP / UDP server on the RPi device either using Python or any other language. On devices the application will then open connection with server and do request for specific action.

I would suggest to adopt approach 2 as it is easy, scalable, maintainable and is a clean approach.

HenryRalph commented 9 years ago

Ok, thanks I already found a solution On Mar 6, 2015 3:10 PM, "Ashish Kshirsagar" notifications@github.com wrote:

Hi dazilli, Sorry to reply late... but let me know if you are still looking to find the solution and I will explain as I could.

— Reply to this email directly or view it on GitHub https://github.com/ashish-kshirsagar/RaspberryPiHomeAutomation/issues/1#issuecomment-77636435 .