Reputation: 211
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.
Upvotes: 10
Views: 2786
Reputation: 1856
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)
}
Upvotes: 3
Reputation: 171
Is suppose this question (and its accepted answer) could help.
In short: getApplicationInfo().sourceDir, as documented here.
Upvotes: 1
Reputation: 6856
If your install location is auto you can either move the application from sd card to phone or vice versa. you can check the app location manually in the device application manager.
Upvotes: -1