Page 1 of 1
Raspberry Pi 3 and Android App
Posted: Fri Apr 15, 2016 2:58 am
by tomlepham2010
Hello I am pretty new to raspberry programming, I would like to ask where to start if I wanted to write an android app to communication and control the raspberry through the wifi. Currently using android studio to write my app. Trying to explore the different methods to control and collect data from the raspberry to the app. I would prefer to avoid the web server method. Advice needed. Thanks.
Re: Raspberry Pi 3 and Android App
Posted: Fri Apr 15, 2016 3:02 am
by MarkHaysHarris777
That totally depends on what you mean by control the PI via Android over wifi... many people do that every day, and they didn't have to write one line of code.
I communicate using my Android phone, over an openvpn connection to my home (using .ovpn file, 2048 bit ras des3 AES encryption) to my rasppi1 openvpn server... from there I can ssh to any of my wifi connected machines, including all of my rasppi(s) !
You have asked a huge question... what specifically are you looking to do?
Re: Raspberry Pi 3 and Android App
Posted: Mon Apr 25, 2016 5:46 pm
by tomlepham2010
Let me be more specific, the project I am currently working on is writing an app to control my pi3. I would like to control it through wifi, meaning creating some sort of connection between the app and the pi through wifi. Anyone with the app can control the pi essentially. The project is door lock, so the app should be able to toggle a unlock/lock triggering the gpio pins of the pi3. Would like to add camera functionally, nfc access tokens from tags or android smart phone, access log, possible cloud database, and general alerts sent to app.
Most of the different functionalities of what I want the pi3 and the app to do require sorting and storing data, first off it will be specific for different user information. In each user profile there will have more database for access information and log, camera snapshot, alerts and etc. I am also confused about how to connect a database between users? Because I assume I will need multiple databases to store the information in different categories.
What I am confused about is the actual communication between the pi3 and the android app? So far all research showed creating a webserver to retrieved and send the data.
Do i need to set the pi3 as wifi hotspot?
Not sure if i should use a webserver of some sort, http, apache, rest or websockets?
Node.js?
Along with that the data interaction between the two devices, using either xml or json?
Just trying to wrap my head around the idea a little bit better.
Re: Raspberry Pi 3 and Android App
Posted: Mon Apr 25, 2016 5:57 pm
by ghans
Can you guarantee that the Pi is always comnected to
the Internet ? The smartphone ?
Perhaps you can connect them to same wireless/wired/mixed
LAN ?
ghans
Re: Raspberry Pi 3 and Android App
Posted: Mon Apr 25, 2016 10:52 pm
by DougieLawson
tomlepham2010 wrote:
What I am confused about is the actual communication between the pi3 and the android app? So far all research showed creating a webserver to retrieved and send the data.
Your choice.
TCP/IP is probably the fundamental transport (layer 3) mechanism (unless you want to explore BlueTooth).
Then
you have to pick the application protocol (layer 4).
HTTP (including websockets)
GOPHER
FINGER
TELNET
MQTT
FTP
SSH
SAMBA/CIFS
NFS
VPN
Roll-your-own (RYO)
That's the piece your professor is trying to get you to do so that you learn about the common layer 4 protocols and can describe a RYO protocol to show you understand the concepts.
Stop fussing about the hardware connection (layer 1), the IP transport (layer2) and the transmission control (layer3) stuff, that's the easy bit and is all about MAC addresses, IPv4 addresses, IPv6 addresses and port numbers. It's the same for most of the application layer TCP/IP users. (I'm ignoring UDP at the moment.)