Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Android App Backend Assistance

Hey guys I need help figuring out the backend for my first android app. How exactly do I make a backend? I have never done server side(spent the day trying to figure out what exact is HTTP and am still no closer) and am just learning java so I have no clue what to learn. A little bit of background on the needs of the backend. It needs to update in real time and speed is key. So any suggestions?

7 Answers

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

That's a good and tough question. The answer totally depends on what you know or want to learn.

So you're starting with data you want to provide on the backend and that you want to consume inside your Android app. The data needs to be transferred in a way that's easy for your app to consume, and for that I'd recommend JSON formatting. We're going to cover that soon in the Build a Blog Reader App project, but there's lots of information on the web to get started with. XML isn't bad, either, if you're used to that, though JSON is better for performance.

There are so many ways to do this, but the basic idea for your backend is:

  1. Set up a server that can host your web service that makes the data available. This could be a simple hosting plan on the web somewhere or something you set up yourself.
  2. Set up a data store with something like a MySQL database
  3. Access the data and serve it up with PHP, Ruby, Python, Java, C#, JavaScript (like Node.js) or whatever else floats your boat
  4. Call the web service via its URL from your Android app

This is something we definitely want to cover in more detail at Treehouse, but hopefully somebody can point you to a good resource to get started. I can't think of anything right now, but off the cuff (and with a quick Google search), I'd recommend working through a "Hello World" web service example in Python and then see if you could set up and consume that simple web service on a server and in your Android app. Then, once you have all the pieces figured out, work on making it the more complex service you want.

It's been a while for me, but I found Python fairly straightforward to pick up, so don't be intimidated by a new language! :) If you want to stick with Java, though, I'm sure you could find some "Hello World" style examples for Java web services.

Okay so I think I get it now. To keep it simple I could just use the Google App Engine as my backend which I can do server side code in Java(at least that is how I think it would work). Now then the question becomes where do I learn about server side technologies? I am Googling around but everything I find is a year or more older. Again thanks for any assistance.

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

If you are just now learning Android, it might make more sense to focus on that for now and use a "backend-as-a-service" (BaaS) company for the backend:

Here's a good article discussing these services: link.

It depends on what your goals are. If you want to learn both pieces, then by all means do it. But if you are primarily interested in learning Android, using one of these could allow to focus your efforts on learning that.

Thank you...now I know what to do but eventually I will have to learn that stuff. I honestly hope by summer 2013 team treehouse has all of that covered. I learned so much in such a relatively short amount of time through the web design track but then I realized I liked android so I stopped. Maybe they will have an Android track...

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

We do have an Android track: [http://teamtreehouse.com/library/android-development]. Ben's completed the first project, and he's hard at work on the second.

Oh wow I cannot believe I hadn't noticed that. Thank you very much... Tell Ben I said thanks.

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

@Randy - thanks for all the helpful information here! Those BaaS links were exactly what I was looking for, though I didn't know the term "BaaS". :)

Also, so glad you pointed @Wesley to the Android projects! I assumed he was working through those. :)