• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Creating a server for my app

Emeriska

Lurker
Hi there!

First of all, I'm new here, but I'm not new to android programming. The thing is I created a couple apps in the past, but all of them were either not using request to a server, or they were using a third party open API. That said, I know how to make API calls and parse Json etc.

That said, I'm working on another project right now witch is a very specific event planner. I'm creating an event planner (much like the facebook feature) that has some specific features for my field of work. Now I have never built my own server before and I have no idea where to start.

In my head right now the steps are:
1. learn the server language
2. ...
3. Have a working server witch I can make calls and get Json replies like I'm used to.

Wtf is step 2?! haha

I know there is a lot of ressources on the net, but it's getting kind of confusing to be honest. So I have a few questions.

What's a good ressources to learn to start building a server? Users in my app will need to communicates with the server but not between them if that's any help. I'm looking to answer theses questions:

What's the best language for the server side? Where should I get it hosted? Any tools I should be using? Best language for the server DB?


Thanks a lot people!
 
Hi, and welcome to Android Forums.
This is a fairly complex area, with a lot of moving parts, and there are a number of ways you can do it, depending on what you want to achieve.
First question you need to ask yourself is, do I need an app?
Mobile apps are a relatively new development, and before this we just had the web. All mobile devices come with a universal web application client (the web browser).
Web applications involve 3 main parts:-

1. A web browser (the client application)
2. The server (returns web pages to the client)
3. A database (stores information needed for the web pages)

The server can simply respond to the web browser's HTTP requests for web pages (written in HTML), and serve up the appropriate page. This was fine when websites were very simple, and consisted of static content, but things got a whole lot more complicated when we wanted dynamic content. By this, I mean that the content of the page can vary, depending on the user's input.
So this is when clever people got creative, and came up with the concept of servlets. A servlet is a piece of code that runs on the server side. It looks at the incoming request, and figures out all sorts of necessary information needed for the rendered web page. This information could come from a database. Servlets can be written using a variety of programming languages, including PHP and Java.
Over the years, various people have invented web frameworks to make the process of rendering web pages simpler. All this stuff builds on what went before, so we've ended up with a huge amount of libraries, both wide and deep. There's a lot of choice in the web framework arena.

Aside from HTML web pages, an alternative approach you might consider is to implement a REST interface. This still uses the HTTP protocol, but normally a REST interface returns specific data in some other format - most commonly this is JSON. (JavaScript Object Notation). From your description, this may be what you need. As there is no HTML web page returned to the client application, this lends itself more to a pure app, rather than a traditional web application, or an app which simply wraps a Webview. You would create an app for your device, and make it call the server's REST interface to retrieve the data.
In order to implement your REST web service, you will need to become familiar with:-

1. Tomcat, or some other servlet container.
2. Implementation of your web service. Possibly using Java

There's a tutorial link below. I'm not saying this is the best, there are probably others available. Fortunately there's no shortage of information about this

https://www.tutorialspoint.com/restful/
 
Back
Top Bottom