Root detection on Android device using MAUI .net framework

Manjunath Vadigeri 0 Reputation points
2025-02-27T09:04:09.0833333+00:00

The Android root detection logic implemented in .NET MAUI is not working as expected.

Tried both a custom implementation and a NuGet package as in link below, but both approaches failed.

nuget package > https://www.banditoth.net/net-maui-jailbreak-and-root-detection/

Root status is determined by checking for the presence of su files on the device. When inspecting a rooted emulator via adb shell, these files were found, confirming that the emulator is rooted.

However, when executing the same logic in code, the File.Exists check fails to detect the su files.

It is unclear whether the app needs elevated permissions to access system folders for root detection. Additionally, it is not yet confirmed if this issue is specific to emulators, as the logic has not been tested on a physical device.

Any help here is greatly appreciated.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,962 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 48,666 Reputation points Microsoft Vendor
    2025-02-28T08:57:16.8866667+00:00

    Hello,

    Monitoring Root is a dangerous behavior. According to community policy, I cannot provide you with relevant methods. The official method recommended by Google is to check integrity through Google Play Integrity. You could refer to the following documents and Nuget Package.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

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