I used the installLocation that allows figuring out if an app can be moved or not. But I cannot figure out what happens when we want to find out if an App has been moved to a SD card.
The ApplicationInfo
attribute FLAG_EXTERNAL_STORAGE
only tells you if the app is installed to the SD not if it has been moved to. I am generating a list of apps that could be moved to SD card. So first list I generate is using the installLocation
of manifest. From this list I got to filter out apps which already have been moved to SD Card.
To Check application is installed in SD Card or not, just do this:
ApplicationInfo io = context.getApplicationInfo();
if(io.sourceDir.startsWith("/data/")) {
//application is installed in internal memory
} else if(io.sourceDir.startsWith("/mnt/") || io.sourceDir.startsWith("/sdcard/")) {
//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