Juan Reynoso Elias
En 2017-07-21 18:44:22

Android studio + Postgresql


1.-  Download  https://jdbc.postgresql.org/download/postgresql-42.1.3.jre7.jar

2.- Copy the jar in /app/libs/

3.- Edit compile files('libs/postgresql-42.1.3.jre7.jar') in /app/build.gradle  file

4.- Adit in app/src/main/AndroidManifest.xml file

5.- Set the code in MainActivity.java  http://paste.lisp.org/display/351378

6.- Modify Postgresql pg_hba.conf like:


# TYPE DATABASE USER ADDRESS METHOD

# IPv4 local connections:

 host all all 127.0.0.1/32 md5

 host all all 0.0.0.0/0 md5

 host all all 0.0.0.0 0.0.0.0 md5

# IPv6 local connections:

#host all all ::1/128 md5

# Allow replication connections from localhost, by a user with the

# replication privilege.

#host replication postgres 127.0.0.1/32 md5

#host replication postgres ::1/128 md5


7.- Modify the file postgresql.conf, set

listen_addresses = '*'          # what IP address(es) to listen on; 


8.- Restart postgresql