Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not showing databases in sdcard #19

Closed
Aexyn opened this issue May 13, 2015 · 6 comments
Closed

Not showing databases in sdcard #19

Aexyn opened this issue May 13, 2015 · 6 comments

Comments

@Aexyn
Copy link
Contributor

Aexyn commented May 13, 2015

My app makes database in Phone Storage and SD card. It is Showing data of Phone Storage but not of sdcard. Location of my db id sdcard/android/data/<myapp_package_name>/files/<database.db>. Is it not supported or just an issue??

@reisub
Copy link
Contributor

reisub commented May 13, 2015

Hi @Aexyn,
we never really needed this but I agree it's a valid use case.

I think this is possible provided we have a way of finding the databases on the sdcard. Currently, we find databases by looking in the directory which android uses to store sqlite databases. I don't think we have something like this on the sdcard. (Can anyone confirm / deny? @zplesac)

I see 2 options:

  1. Recursively check all the files in the sdcard to see if any of them are sqlite databases. I'm not sure if we have a way of doing this. Maybe we can use the file command (http:https://linux.die.net/man/1/file)?

  2. Pass in (through intent extra) a list of database locations which are not in the standard database folder of the app so we can show those, too. This complicates usage when you have sdcard databases because you can't just use the launcher icon but have to start DbInspectorActivity explicitly.

I'm not sure when we will have time to investigate these options further, maybe in a couple of weeks time.
Would you care to investigate this and make a pull request?

@reisub
Copy link
Contributor

reisub commented May 13, 2015

I just got a better idea.
We can define an empty string array in resources of dbinspector so the app can override this string array like this:

<string-array name="dbinspector_external_databases">
  <item>/sdcard/android/data/files/my-db.sqlite</item>
</string-array>

And we just use it to add those databases to the list.
How does that sound, @Aexyn ?

@Aexyn
Copy link
Contributor Author

Aexyn commented May 14, 2015

Or Search in this
String pathOfOurApp = getApplicationContext().getExternalFilesDir(null).getAbsolutePath();

this is the path given to app to store its personal data on external sdcard. Sd card may be present , may be not

@reisub
Copy link
Contributor

reisub commented May 14, 2015

Sure, this can work if we can determine if the file is an sqlite database without relying on the extension. (See #14)
We'll see what we can do about this when we find some time. In the meantime, feel free to experiment or implement it yourself.

@Aexyn
Copy link
Contributor Author

Aexyn commented May 14, 2015

I Have created a pull request. See if that works

@reisub
Copy link
Contributor

reisub commented May 24, 2015

I merged in your pull request.

@reisub reisub closed this as completed May 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants