I am working on one application that has some features can be only work in rooted devices.
Almost done and application also working in rooted devices. But some of devices are using SuperSU and in this case application is not working properly.
I also research and discussed with Custom ROM developer and they are saying that your app is not asking for SuperSU Permission but it should.
I did many research on the same topic didn't get any proper way to achieve that.
I found the solution for this.
There is three options in the SuperSU
app under Settings Tab > Default Access
.
So there is two case.
1. If SuperSU
app will have "Grant" set by default in Settings Tab > Default Access
, then app will not ask for SuperSU
permission in application.
2. If SuperSU
app will have "Prompt" set by default in Settings Tab > Default Access
, then app will ask for SuperSU
permission whenever required.
To ask SuperSU
permission on app launch, i have used RootTools to check for SuperSU Access.
So, I just checked for root access by a simple condition using RootTools.
if (RootTools.isAccessGiven())
Toast.makeText(this, "SU Permission Granted", Toast.LENGTH_SHORT).show();
else
Toast.makeText(this, "SU Permission Denied", Toast.LENGTH_SHORT).show();
So whenever RootTools.isAccessGiven()
will execute, it will autometically open a popup to ask for SuperSU Permission for the app. Later you can change it from the SuperSU Application as well.
This is what i found and implemented. Everything working fine now.
Thank you