react-native-root-checker

0.4.0 • Public • Published

Android Installation

Install the npm package react-native-root-checker.

npm install --save react-native-root-checker

For RN 0.59 and below

include ':react-native-root-checker'
project(':react-native-root-checker').projectDir = file('../node_modules/react-native-root-checker/android')

In android/app/build.gradle, add a dependency to ':react-native-root-checker'

dependencies {
    implementation project(':react-native-root-checker')
}

Next, you need to change the MainApplication of your app to register FullScreenPackage :

import com.rootchecker.RootCheckerPackage; // add this import

public class MainApplication extends Application implements ReactApplication  {
    //...

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          new RootCheckerPackage() // add this manager
      );
    }

How to use

Next, you need to add the these to your own component :

    // for android
    const checkForRootStatus = async () => {
        try {
            const rootedStatus = await RootChecker.isRooted(googleDeviceVerificationApiKey);
            console.log(rootedStatus);
        } catch (error) {
            console.log(error.message);  // See reference below  
        }
    }

    RootChecker.isJailBroken()

Error Code on CATCH for ANDROID

  • 601 -> SAFETY_NET_ERROR -> Safetynet error, need to debug to find out this error.

  • 602 -> SAFETY_NET_API_REQUEST_UNSUCCESSFUL -> SafetyNet request failed, (This could be a networking issue.).

  • 603 -> RESPONSE_ERROR_VALIDATING_SIGNATURE -> SafetyNet request: success, Response signature validation: error.

  • 604 -> RESPONSE_FAILED_SIGNATURE_VALIDATION -> SafetyNet request: success, Response signature validation: fail.

  • 605 -> RESPONSE_VALIDATION_FAILED -> SafetyNet request: success, Response validation: fail/

  • 611 -> NATIVE_C_ERROR -> Native C root checker error, need to debug to find out this error.

Package Sidebar

Install

npm i react-native-root-checker

Weekly Downloads

41

Version

0.4.0

License

MIT

Unpacked Size

526 kB

Total Files

56

Last publish

Collaborators

  • drizward
  • zaenalarsy
  • mikelaku6