Hello, dear users of this forum. I have one problem. You need to create an android application that will connect to the PostgresSql database (on the server) and download books from there (yes, books are stored in the database). In these matters, I do not really understand. Is it possible to somehow connect from android to Postgres and search for the necessary books using sql queries? Or it should be web services. Please suggest where to start and what to study. Thank.
- So here start and finish. You have to write this whole poem, start small how to connect to Postgres from Android - this in itself is not so easy :) - Barmaley
- @Barmaley, Yes, I have already rummaged through a bunch of information since writing this post. I realized that it’s best to use Web Services or Restful API, now I’m thinking about how to tie everything together) - ReturnedVoid
|
1 answer
Start with the Restful server, which responds with json'ami requests from the device. The device then parses the json line and outputs the results to the UI. You need to develop a vocabulary of requests to the server. Type:
https://myhost.com/library?list=all&sort=descending gives a list of all books sorted in descending order.
Or:
https//myhost.com/library?bookid=123 Returns book content with id 123
See how other services APIs are organized, for example Flickr.com - public photo hosting with Restful service
On the server side, there should be some kind of backend that incoming get / post requests correctly translate to Postgres SQL and return the results to the client in the form of a json string.
Something like this.
|