Install Android-Native-Root-Detector
mainTo use this tool, download the latest version from the official GitHub Releases page.
https://github.com/reveny/Android-Native-Root-Detector/releasesrepository·main·Indexed 20 days ago
https://github.com/reveny/android-native-root-detectorA library for detecting root access on Android devices using native C++ methods via JNI. It provides the Native.getDetections() function to perform checks and includes components like AppSettingsDataStore, AppSettingsRepository, and SettingsViewModel for managing application configurations and experimental detection flags.
To use this tool, download the latest version from the official GitHub Releases page.
https://github.com/reveny/Android-Native-Root-Detector/releasesThe SettingsViewModel is a Hilt-injected ViewModel used to update application-wide settings via the AppSettingsRepository. All setter methods are asynchronous and execute within the viewModelScope.
Available methods for updating settings include:
setLanguage(language: Language): Updates the application language.setThemeColor(themeColor: ThemeColor): Updates the selected theme color.setDynamicColor(dynamicColor: Boolean): Toggles dynamic color support.setDarkTheme(mode: Boolean): Toggles dark theme mode.setContrastMode(contrast: Boolean): Toggles high contrast mode.setDisableTelemetry(disableTelemetry: Boolean): Toggles telemetry collection.setEnableExperimentalDetections(enableExperimentalDetections: Boolean): Toggles experimental root detection features.The AppSettingsRepository provides a high-level API to access and modify application configuration settings, such as language, theme, and telemetry preferences. It wraps an underlying AppSettingsDataStore to persist these settings.
You can observe the current application settings by accessing the data property, which returns a stream of the current configuration.
Most modification methods are suspend functions and should be called from a coroutine scope. Available settings include:
setLanguage(value: Language)setThemeColor(value: ThemeColor)setDynamicColor(value: Boolean)setDarkTheme(value: Boolean)setContrastMode(value: Boolean)setDisableTelemetry(value: Boolean)setEnableExperimentalDetections(value: Boolean)You can use updateDarkThemeBasedOnSystem(context: Context) to automatically synchronize the application's dark theme preference with the Android system's current UI mode.
Native class provides a bridge to the native C++ detection engine via JNI. To perform root detection, call the getDetections external function. This function requires the application Context, the PackageManager, and a boolean flag enableExperimental to toggle experimental detection methods. It returns an Array<DetectionData> containing the results of the various root detection checks performed by the native library.The AppSettingsDataStore class provides a high-level API for reading and updating application settings using Jetpack DataStore. It exposes the current settings as a Flow<AppSettings> and provides individual suspend functions to update specific configuration values.
Access the current settings stream via the data property:
val settingsFlow: Flow<AppSettings> = appSettingsDataStore.dataUse the following suspend functions to modify settings. These operations are atomic and should be called from a coroutine scope:
| Method | Parameter | Description |
|---|---|---|
setLanguage(value: Language) | Language | Sets the application language |
setThemeColor(value: ThemeColor) | ThemeColor | Sets the theme color |
setDynamicColor(value: Boolean) | Boolean | Enables/disables dynamic color support |
setDarkTheme(value: Boolean) | Boolean | Enables/disables dark theme |
setContrastMode(value: Boolean) | Boolean | Enables/disables high contrast mode |
setDisableTelemetry(value: Boolean) | Boolean | Enables/disables telemetry collection |
setEnableExperimentalDetections(value: Boolean) | Boolean | Enables/disables experimental root detection features |
The getDetections function is an external native method that executes the core detection logic.
Parameters:
context: Context: The Android application context.pm: PackageManager: The system package manager.enableExperimental: Boolean: A flag to enable or disable experimental detection techniques.Returns:
Array<DetectionData>: An array of detection results.