I found the solution for this.
There is three options in the SuperSU
app under Settings Tab > Default Access
.
http://prntscr.com/oyzeq8
- Prompt : It means, app will ask for permission whenever required.
- Grant : it means SuperSU will automatically grant permission for the app whenever required.
- Deny : it means SuperSU will automatically deny permission for the app whenever required
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.
- https://github.com/Stericson/RootTools
- https://code.google.com/archive/p/roottools/wikis/Usage.wiki
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