-2

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.

Ajay Mehta
  • 843
  • 5
  • 14
  • 1
    Nobody is going to be able to help here as there's not enough information. What do you mean it doesn't work properly? Does it crash? Does it just not do a specific task, you'll need to post logcat (especially if it crashes) and most likely some code which shows what's going wrong and how – Boardy Aug 27 '19 at 16:22
  • @Boardy: No it is not crashing but the features which should work on Rooted devices are not working in the devices which have SuperSU. Also my application is not asking for Permission like [this](http://prntscr.com/oyhksj).Is there anything i missing in application? – Ajay Mehta Aug 28 '19 at 06:43
  • Does https://forum.xda-developers.com/showthread.php?t=2719061 or https://forums.androidcentral.com/samsung-galaxy-s5/519088-why-do-some-apps-prompt-root-access-but-few-dont.html help - it sounds simiar? – Boardy Aug 28 '19 at 13:33

1 Answers1

0

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

Ajay Mehta
  • 843
  • 5
  • 14