Share via

Effective Way to Detect Whether an Android Device is Rooted Using MAUI

Manjunath Vadigeri 40 Reputation points
2025-01-28T12:10:18.3833333+00:00

I’m currently working on a MAUI-based application and need an effective way to detect whether an Android device is rooted. I’ve tried a couple of approaches, but none seem to work reliably. Here’s what I’ve attempted so far:

1. Simple Approach Using su Command

I started with a straightforward method to check for root access by executing the su command:

bool isRooted = Java.Lang.Runtime.GetRuntime().Exec("su").ExitValue() == 0;

However, this approach fails to detect root access. Interestingly, running su via adb shell on the same device successfully grants superuser access ($ changes to #), but the above code doesn’t work as expected.

2. Using a NuGet Package

Next, I tried using a NuGet package called banditoth.MAUI.JailbreakDetector:

This package checks for:

  • Presence of superuser executables (e.g., su).
  • Known rooting apps installed on the device.
  • Write permissions in restricted directories.

Unfortunately, this solution also fails to detect root access on my test device.

Request for Suggestions

I’m looking for a reliable and effective way to detect root access on Android devices using the .NET MAUI framework. If anyone has successfully implemented root detection in a MAUI app, I’d appreciate any guidance or code examples.

Developer technologies | .NET | .NET Multi-platform App UI
0 comments No comments

3 answers

Sort by: Most helpful
  1. Michael Le (WICLOUD CORPORATION) 11,325 Reputation points Microsoft External Staff Moderator
    2025-08-20T04:04:45.4966667+00:00

    Hello,

    The most effective and Google-recommended approach is to use the Google Play Integrity API.

    • It provides a secure verdict directly from Google's servers about the integrity of the device.
    • Unlike client-side checks that can be manipulated, the server-side verification is much more difficult to fool.

    For enhanced security, you can combine the Play Integrity API's verdict with a few client-side checks (like looking for common rooting apps or suspicious system properties) to create a risk score. However, the Play Integrity API should be your primary method for detection.

    I hope this helps you with your issue.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

  2. Linhnguyen Hanoi 75 Reputation points
    2025-08-25T13:13:58.55+00:00

    Monitoring Root is a dangerous behavior. We generally do not recommend checking whether the device is rooted.

    The official method recommended by Google is to check integrity through Google Play Integrity. For more information, you can refer to the following documents and package:

    Google.Apis.PlayIntegrity.v1 and Google Play Integrity API documentation.

    Was this answer helpful?

    0 comments No comments

  3. Bruce (SqlWork.com) 84,086 Reputation points
    2025-01-28T19:25:55.5666667+00:00

    you should see this thread (your approach can lead to zombie processes):

    https://stackoverflow.com/questions/1101380/determine-if-running-on-a-rooted-device

    the consensus is to use google play api:

    https://developer.android.com/google/play/integrity/overview

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.