Search code examples
androidrootsd-card

How to detect when an App is force moved to SD-Card on rooted Android


I have declared my App as internalonly, yet some rooted users move it to SD-Card.

How can I detect at run-time that this has happened? I do not trust the information that packagemanager is reporting as these are rooted phones and my app should not had been moved to SD-card anyways.

Thanks!


Solution

  • Have the application open /proc/self/maps and look for an entry that is an apk file and look at its path.

    Why exactly are you concerned about this? Hopefully it is because of a functional reason, such as problems if the SD card is unavailable. Doing it for security purposes is of limited point on a rooted device.

    If you detect it and complain, please have the error screen state why it is a problem. Just claiming "it's not allowed" or giving bogus reasons will only prompt people to figure out how to out-fake your fake-out detection and in the meantime leave you poor ratings in the market.