Is there a method in Android that returns the data path on internal storage?
I have 2 Android smartphone (Samsung s2 and s7 edge) where i installed an application. I want to take a sqliteDB situated in this path:
/Android/data/application.most/files/most_db
The problem is that in Samsung s2 i must use this path to take the DB:
private static final String db_path = "/storage/sdcard0/Android/data/org.application/files/application_db";
Instaed, in s7 i must use this:
private static final String db_path = "/storage/emulated/0/Android/data/application.most/files/application_db";
I want to take this path independently by device.
Can you help me?
Thanks in advance.
Internal Storage(UT) location: /storage/sdcard0 . Note that /sdcard & /storage/emulated/0 also point to Internal Storage(UT).
Your app's portion of internal storage will be on the /data/ partition. Exactly where depends upon the account that is running your app (Android 4.2+ supports multiple accounts per device). The primary device account will have your app's portion of internal storage be at /data/data/your.
I think that what you're looking for is something like that
String path = getFilesDir().getAbsolutePath();
Once change your Logic in different versions..
till android 4.xx it take internal memory as /storage/sdcard0/
where as from 4.4 kitKat it will take path as /storage/emulated/0/
Design multiple apk depending on android API versions...
your problem is solved.. you can install it in s2 with that path and S7 with this path...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With