Setting up an online server database and binding my native Android application to interact with it

I am developing a very simple Android application that contains a simple Main menu with the options for Today, Yesterday, This Week, This Month, and Search by Date.

enter image description here

(I bought the lynda course: "Creating Android and iOS Applications with Dreamweaver" with HTML5 and with the design and functionality of the im application without too many problems.)

What I impose on this application is this: I will write famous profiles of people every day (from 1 to 5). Therefore, when people click (for example) in the "Today" option, they will get access to the list of profiles that I created for today (yesterday and others - checking the past recorded profiles from the database).

So, imagine that today, an Android user user clicked on it and will be presented with three profile parameters ("Brad Pitt", "Shakira" and "Cristiano Ronaldo") that I need an application to access my server database in order to update it (Today profiles).

enter image description here

and finally ...

enter image description here

Before asking questions, I want to say that I searched stackoverflow and found very similar answers, but I'm new to programming, and when I read the answers, they can vary so much that I get confused in the link to the documentation link.

Questions:

  • I want to create somekind method so that I have a template with different profiles (Singer, Politician, Soccer Player) and click the somekind button to start a new profile / article with Born Date, Occupation, National, Biography, etc. Is it possible? How can I do this and in what programming language?

  • Which server and which database do I need to create and how to configure it to send information to my application?

  • Are there any server specifications that I must have for this to work smoother and simpler? For this issue, price is not a problem.

  • What code should I write in my application so that it can receive the “3 profiles today” update on my website?

  • Is it possible to show me an example of code that will work with this simple step in my application, selecting the Today button in the main menu and in the application, checking new profiles for today and introducing the user as an option? Because if I had this bit of code, I could better understand how to do the rest with profile details on the “Brad Pitt” option, for example.

I hope you understand my questions. Thank you in advance. A good day

+4
source share
1 answer

Assuming you are using Phonegap Framework to develop your application, I would do it like this: First of all, get a server / web space capable of running PHP scripts and MySQL Database .
You also need to rethink how these applications work, for example you cannot

configure it to send information to my application

You need the server side of the Script (I would choose PHP for this, it is easy to learn and use on almost every server). This PHP script then queries your MySQL Database , which stores all the information about people. What you need to remember is that your clients will poll the server and request content, you will not actively send any messages to Clients, if this is not requested, the way HTTP works. The interface provided by your Script is called the REST interface. Look at the link, it explains everything pretty well. The output format should be JSON , which makes it very pleasant to work in the client application later. Do things like "what was published today?" See how SQL queries work and implement them in Script.

Now for the client, you can access this data using JavaScript , most likely jQuery , to simplify everything. Use the jQuery $ function . GetJSON to access data provided by your REST Interface . Now you can use basic jQuery to wrap this data with HTML to present it to the user. I know that this is not “sample code” or everything that you asked for, but it should point you in the right direction on how to achieve something that you want to do. Just do a Google search for all the keywords above and keep reading about it, then you can create such an application.

+2
source

Source: https://habr.com/ru/post/1447935/


All Articles