androidrootsuperusercustom-romroot-access

Application is working on rooted device but not working with SuperSU


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.


Solution

  • I found the solution for this.

    There is three options in the SuperSU app under Settings Tab > Default Access.

    http://prntscr.com/oyzeq8

    1. Prompt : It means, app will ask for permission whenever required.
    2. Grant : it means SuperSU will automatically grant permission for the app whenever required.
    3. 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.

    1. https://github.com/Stericson/RootTools
    2. 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