简体   繁体   中英

Connecting to a MySQL DB and putting the DB on an android phone

Right now in my app I connect to a MySQL DB as a "as needed" for getting information on a online game I play (the app is a sort of information based and a performance enhancer for game-play), but I now find myself seeing that on an orientation change or just hitting back and going back into the same section of the app I always have this loading that needs to happen which even to me gets me a bit upset/frustrated on the wait time that needs to be done which will disturb the user experience which I 100% want to avoid.

So my questions on this was:

  1. How can I get the entire MySQL DB onto the phone quickly and efficiently?

  2. When the app exits does the DB table still reside there on the phone?

How can I get the entire MySQL DB onto the phone quickly and efficiently?

You probably can't. That database could be anywhere from 1.1x - 300x the size of your available device's capacity. The occasional calls to retrieve only what it needs are more efficient than trying to pump (potential) gigabits to its clients.

When the app exits does the DB table still reside there on the phone?

This is strongly dependent on the implementation of the application. If there's a justification to cache that kind of data (I'd presume info such as countries or dates or constant values would stick around), then it might. Otherwise, you'd be better off taking it up with the developer themselves.

I'm not entirely familiar with Android (yet), but at some point in the lifecycle of an application, typically on an orientation change, the application itself is destroyed/recreated for that orientation. It could be that the work to connect to the DB is done in an inappropriate layer, hence why you're seeing such poor performance.

You'd really want to take this up with the developer. If you don't have the source code to change this, there's not much we can suggest that will help.

I want to help you, but I need more information about your problem.

What version of MySQL you are using?

You can use SQLite or save and load the data from a xml file.

Regards,

You have not to get everything from the database. You just need load the information needed for application.

How to get from a MySql server to an Android app?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM