Popular Posts

Tuesday, September 27, 2016

RootCheckUtil Library

RootCheckUtil Library



This library is specifically designed to check if the user has root access or can gain root access in android OS.
It is necessary if you have some sensitive information in your app and don't want the user to get inside the android system and steal or tamper your app.
If user has root access aka administrator access, he can access the database files, shared preference and software backed key-store files.

This library has 2 methods:


1. isDeviceRooted() - This will return a Boolean value true if the device is rooted.
Note: It will return true if used in an emulator since emulator is a virtual test device.

2. isEmulator() - This will return a Boolean value true if the device is Emulator.

You can find the library here.

Steps to include this library in your project:-


1. Create a android project.

2. Go to project root folder.

Navigate to \"app_name"\app\libs\

3. Paste the rootcheckutil.aar downloaded from the github inside the libs folder.

4. Go to File-> New -> New Module.





5. Navigate to libs folder of app where we pasted rootcheckutil.aar.


6. Sync the gradle.

7. In the project structure add the rootcheckutil as a module dependencies.


8. Now you can use the library.

Eg Code:-
TextView tv = (TextView) findViewById(R.id.tv);

tv.setText("Is Device Rooted: "+ RootCheckUtil.isDeviceRooted());

TextView tv1 = (TextView) findViewById(R.id.tv1);

tv1.setText("Is Emulator: "+ RootCheckUtil.isEmulator());

No comments:

Post a Comment