Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
925 views
in Technique[技术] by (71.8m points)

java - Android permission of creating database

Hi I have some problems in creating the sqlite database in android.

Everything is ok on the emulator, I can create the database. But it doesn't work on the actually machine. When I tried to debug the application on my phone, it just failed to create the database.

So can anyone tell my what happened? Is there any special permission I need to add in the Manifest file? I've tried ACCESS_CHECKIN_PROPERTIES or WRITE_EXTERNAL_STORAGE, but still cannot get the database.

By the way, is the custom database can only be stored in the sd card but the root directory?

Thank you very much!!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Without any feedback in the error, it is impossible to tell you what's wrong in your code. Nevertheless, I can tell you that you do not need ACCESS_CHECKIN_PROPERTIES for using your own database. You should not need WRITE_EXTERNAL_STORAGE either unless you are trying to access the sdcard.

The databases are stored by default in a subfolder of your app folder in the internal storage, i.e.:

/data/data/YOUR_APP/databases/YOUR_DATABASAE.db

If you do that on a physical device it has to be rooted though.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...