Server data collection

I am developing an Android application for an organization, but a problem has occurred. Although my programming knowledge is relatively fair, my use of Java was newer. This is the biggest part of my current problem, as I need to know how to configure the application to retrieve data from the server. The closest example is the form of "news" applications currently available. When you open the application, it updates the currently available articles or audio. I hardly know how to create or implement the necessary code to perform such data sampling. I also do not know what needs to be done on the server side so that the application can receive the corresponding data. (Once again, these will be text articles and audio files). I came to this forum to ask for help in solving my problem.

+1
source share
3 answers

Your server should respond in a format that your client can understand. For example, you can respond in plain text, XML, or JSON. You can implement your server like any other website, but you can keep it very minimal and respond with plain text instead of HTML.

Then you implement your client so that he can understand the format you are using. And you can send and receive messages using HttpClient.

You can use Jackson to control JSON on your Java client on an Android phone. There is a tutorial on using Apache HttpClient that may be useful. And finally, thereโ€™s an interesting conversation about Googleโ€™s Android REST client applications on Youtube.

0
source

I would suggest using Rails for the backend. You can create a simple rails application with a database and rails with a default REST interface (which means it would be easy to get a record from the database using a URL). After you have set this setting, you can simply call the url from your Android application by changing the necessary parameters. Rails also takes care of the response data in JSON or XML (without additional encoding), which simplifies your analysis in the Android application.

If you are new to Rails, the simple setup described above (database and URL fetching) is unlikely to take half a day.

0
source

Why java With the HTML5 functionality currently available, you get a complete relational database, offline / online integration. And a reasonable language for creating user interfaces!

Serverside ..... whatever. I find Java PITA to work with web applications (mainly using PHP), but there are also Ruby, Perl and others. Of course, you will need some clever people to figure out what content the client needs to click.

While there is no end to open source CMS, I donโ€™t know which one is designed to work in a standalone client - there is a new business model here!

-2
source

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


All Articles