How to connect Android applications with raspberries PI ...?

I can program my raspberry PI to control my GPIO using the Python library or Wiring-PI C. I can control it using web interfaces like webiopi or web2py.

What I intend to do is write my own Android application (only the layouts created by me), and I want this application to remotely connect to PI and run the code saved for the GPIO control.

I want my Java code to control my C code remotely or something like that.

I have no idea which libraries I need for such an interaction, and I would appreciate any ideas.

+4
source share
2 answers

How you can control your raspberry Pi using web interfaces like webiopi or web2py, why not use the REST API from the Android app.

Android REST API Client Library

Restful API Service

If you are looking for more ideas, you can consider a Bluetooth client server application with an Android client (on the device) and a Java / Python server (running on pi)

Initializing the connection of the android bluetooth connection (client) to python (server) on a PC

+3
source

you need to configure the server on your raspberry pi to receive GET or POST calls.

Then from your Android application, use plain standard Java to call this web service and get a suitable response, for example. GPIO status.

for example, an Android application uses a GET request for http://192.168.0.10:8080/GPIO/Toggle/3 , your raspberry Pi server, listening on port 8080, will switch GPIO 3 and respond to Android 00001000 (this means that GPIO 3 is on )

But this is just one possible idea, you can use a library like Kryonet to exchange data on traditional sockets.

+3
source

All Articles