-1

I'm currently working on developing an android application that needs to connect to a Raspberry Pi over a local WiFi connection and read some data from a file stored on the RPi. I'm not really sure where to begin on this and what resources I can use. I already have the layout of the application set up and just need to write the code.

So my question is how should I write the android application to read a file from a Raspberry Pi that is connected to a local WiFi network? The file on the Pi could be either a JSON file or a plain text file.

  • 1
    You have 3 people who were kind enough to give you some sound guidance on things you can research to get you started. You should do some google searches now, and ACTUALLY TRY SOMETHING. StackOverflow is to assist people with programming problems. You don't even have a problem yet, you just have an idea you haven't put enough time into researching yet. – Baronz Feb 22 '16 at 21:49
  • I'm just trying to understand what you guys are suggesting. I understand that I need to put some sort of server software on the Pi. But I don't understand how to access it from android. Thanks for the vote of confidence. – schillingjerrid Feb 22 '16 at 22:11
  • I went to google, typed in "read a text file from android from a web server" and I got this StackOverflow page with the answer right on top: http://stackoverflow.com/questions/2922210/reading-text-file-from-server-on-android – Baronz Feb 22 '16 at 22:31

2 Answers2

3

Host the files with Apache, and then download them with WebClient.DownloadString

EDIT: For Android, look into this

Community
  • 1
  • 1
Viggo Lundén
  • 748
  • 1
  • 6
  • 31
  • 2
    Or, install Samba on the raspberry and refer to [this post](http://stackoverflow.com/questions/9389366/how-to-access-share-folder-in-windows-through-android-and-read-files) – drakyoko Feb 22 '16 at 19:07
  • How do I download them with WebClient.DownloadString if that is made for .NET? I'm working with Java. – schillingjerrid Feb 22 '16 at 22:07
  • @schilling399 Look into this: http://stackoverflow.com/questions/2098606/is-there-something-similar-to-webclient-downloadstring-in-java – Viggo Lundén Feb 22 '16 at 22:10
  • Thank you for your suggestion. This will get me started in the right direction. – schillingjerrid Feb 22 '16 at 22:18
  • WebClient.DownloadString is for .NET, it's off-topic to this Android question. (Unless you're using Xamarin) – Baronz Feb 22 '16 at 22:32
2

For your case, I'd say stop thinking about it as a Raspberry Pi. My guess is that you're going to put NOOBS\Raspberian on it. At that point, it's a linux server.

You can put Apache on it, or an FTP server, or do some google searches on accessing a linux server from android to see a variety of different design patterns that accomplish this task.

Baronz
  • 667
  • 5
  • 16