ASP.NET Tutorial : How to Detect the Root/Jail Broken Detection .NET MAUI?

Leave a Comment

Developing a secure.NET MAUI app is critical. Rooted/jailbroken devices can bypass security protections, making them exposed. This can have an impact on both the data and operation of your app. Let's look at the hazards and how to integrate root/jailbreak detection in your.NET MAUI app.

Set up the project, install the plugin, implement it, and download the code.

Project Setup in Visual Studio
Launch Visual Studio 2022, then click Create a new project in the start box. 

In the Create a new project window, select MAUI in the All project types drop-down, select the .NET MAUI App template, and click the Next button:

  • In the configure your new project window, name your project, choose a suitable location for it, and click the Next button.
  • In the Additional information window, click the Create button:
  • Once the project is created, we can able to see the Android, iOS, Windows and other running options in the toolbar. Press the emulator or run button to build and run the app
Install Plugin
  • Open your Nuget Package Manager and search "banditoth.MAUI.JailbreakDetector" and install the latest version in your project.
  • Open MainPage.xaml file and update the UI as per your requirement. In this sample, I have added a button to check whether the device is rooted or not.
  • You can dependency inject the jailbreak detector instance by resolving an instance of IJailbreakDetector. Store the instance in a private readonly field in your class, or use it directly.
    IJailbreakDetectorConfiguration jailbreakDetectorConfiguration = new JailbreakSettings();
    jailbreakDetectorConfiguration.MaximumPossibilityPercentage = 20;
    jailbreakDetectorConfiguration.MaximumWarningCount = 1;
    jailbreakDetectorConfiguration.CanThrowException = true;
    IJailbreakDetector jailbreakDetector = new JailberakDetectorService(jailbreakDetectorConfiguration);
  • Use the following code to check whether the device is rooted or not.
    if (jailbreakDetector.IsSupported())
    	var isRooted = await jailbreakDetector.IsRootedOrJailbrokenAsync();
    	if (isRooted)
    		await DisplayAlert("ANDROIDMADS - .NET MAUI", "DEVICE IS ROOTED", "OK");
    		await DisplayAlert("ANDROIDMADS - .NET MAUI", "DEVICE IS NOT ROOTED", "OK");

    Windows Hosting Recommendation

    HostForLIFEASP.NET receives Spotlight standing advantage award for providing recommended, cheap and fast ecommerce Hosting including the latest Magento. From the leading technology company, Microsoft. All the servers are equipped with the newest Windows Server 2022 R2, SQL Server 2022, ASP.NET Core 7.0.10 , ASP.NET MVC, Silverlight 5, WebMatrix and Visual Studio Lightswitch. Security and performance are at the core of their Magento hosting operations to confirm every website and/or application hosted on their servers is highly secured and performs at optimum level. mutually of the European ASP.NET hosting suppliers, HostForLIFE guarantees 99.9% uptime and fast loading speed. From €3.49/month , HostForLIFE provides you with unlimited disk space, unlimited domains, unlimited bandwidth,etc, for your website hosting needs.

  • Next PostNewer Post Previous PostOlder Post Home


    Post a Comment