[Solved] What is the best way to have only single database connection throughout whole android app life?


THere is no way, not how you’re doing it. You’re making individual HTTP connections for each request. Unless your webserver only maintains a single instance of a database connection for all requests, its going to create new ones for each request (this would also mean your website only has a single server- in other words not true for any non-trivial app).

My suggestion is to redesign your feature such that you aren’t making an HTTP request per character. That means either removing autofill, or sending down more data with each request and doing processing client side to filter out possibilities. Or accepting that autofill responses will be slow and may be obsolete by the time they return.

1

solved What is the best way to have only single database connection throughout whole android app life?