2

I apologise for the very general question but I'm looking for some advice. I have two products that I have created for a project. An android app and a website service. I want the android app to be able to connect to a PostgreSQL database in order to authenticate user login and submit a small amount of data.

The data on the PostgreSQL database will then be produced on the website. Simples!

I'm wondering if there are some tutorials or discussions that provide a simple solution to this. I've looked at loads of forums which mention using a lot of complicated protocols, frameworks, etc.

I'm just looking for some nice efficient android examples on how to achieve this.

Any advice would be appreciated.

2
  • IMHO best would be to let backend server, where website is running, handle db operations and create webservice for it so that android can communicate with it. This way your website and android both will use same database and able to exchange data if required. You will easily find some examples online to do this. Commented Mar 4, 2013 at 10:50
  • Answers to earlier posts along similar lines: stackoverflow.com/a/10441565/398670, stackoverflow.com/a/12850283/398670 Commented Mar 4, 2013 at 12:40

1 Answer 1

2

You should not worry about android and PostgreSQL communication because they won't communicate directly.

All what you need is a simple HTTP communication between your android and the web service to send and receive information (e.g. credential for authentication)

Your web service should take care of storing and retrieving data from the database

Sign up to request clarification or add additional context in comments.

3 Comments

but if user credentials are stored within a postgreSQL database. I.e. a datatable called 'Users'. Surely the android app must connect to the PostGreSQL database to compare the data entered on the app to the data stored within the database?
No the android app should only communicate with the web service e.g. call authenticate(username,password) and inside the web service you do the database connection with postgreSQL database.
I'm really struggling to understand the logic. So the app will request the web service to send user credentials and then authenticate them? Could you possible give a code example?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.