I am trying to get the location of app by passing package name to check if its installed on internal or external storage. Please help.
U can check this code and see whether we have installed on internal or external storage
(Note: u can use it in oncreate or any where)
ApplicationInfo io = getApplicationContext().getApplicationInfo();
if(io.sourceDir.startsWith("/data/")) {
Toast.makeText(this,"your app is in internal storage",Toast.LENGTH_LONG).show();
//application is installed in internal memory
} else if(io.sourceDir.startsWith("/mnt/") || io.sourceDir.startsWith("/sdcard/")) {
Toast.makeText(this,"your app is in external storage",Toast.LENGTH_LONG).show();
//application is installed in sdcard(external memory)
}
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