0

This is my code. I've to insert device id into Postgresql database table. How do I connect android app with Postgresql and perform sql operations?

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        TextView textview = (TextView) findViewById(R.id.textView);
        String id = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
        textview.setText(id);
    }

}

1 Answers1

0

Instead of connecting directly to PostGreSQL, you can connect via the server-side application. For example, let's say we have created a node.js application. On the Android side, all you have to do is send the data to the server-side application. It is very simple to connect with the database in server-side applications.

Pehr Sibusiso
  • 862
  • 1
  • 14
  • 27