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.

WebDevDanno
  • 1,122
  • 2
  • 22
  • 50
  • 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. – Harry Joy Mar 04 '13 at 10:50
  • Answers to earlier posts along similar lines: http://stackoverflow.com/a/10441565/398670, http://stackoverflow.com/a/12850283/398670 – Craig Ringer Mar 04 '13 at 12:40

1 Answers1

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

iTech
  • 18,192
  • 4
  • 57
  • 80
  • 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? – WebDevDanno Mar 04 '13 at 16:19
  • 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. – iTech Mar 04 '13 at 20:55
  • 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? – WebDevDanno Mar 05 '13 at 11:02