The purpose in this context is to prevent false high scores(my app is a game) from being reported in LeaderBoard. This occurred for Flappy Birds - see this link - http://www.androidpit.com/forum/589832/flappy-bird-high-score-cheat-set-your-own-high-score
Since a root user can do anything he wants with his mobile, I suppose none of the other work around will work and the only solution is to prevent rooted users from installing the app. Am I right? Is there a way to do it?
PS: My game doesn't need internet connection always, hence reporting the scores as and when it happens to another server is not viable. The high scores are reported to leaderboard only when internet connection is available.
I had a similar requirement. I couldn't achieve that app should not be installed on rooted device, but I used a work around for that:
onResume
.Example:
DeviceUtis.java
was a Utility class which returned if a device is rooted or not.We had used 5 methods for testing, and I have just shown 2 here. You can use any of methods you find good.
Hope this helps.
P.S: I have put this call in all activity's
onResume
as user (with intention of hacking) can install application, navigate to some other activity, and then root device.