Debug .NET MAUI Android apps with Android work profile
An Android Work Profile is a feature that allows you to separate work apps and data from personal apps and data on the same device. This is particularly useful for maintaining privacy and security in a corporate environment. However when you are developing an app for your company, who’s got these configurations on their mobile devices, you might find yourself in a tricky solution, because VS Code simply installs the app on the workprofile and on the normal profile aswell, but only can run with debug on the normal profile without any configuration. Get the users of the Android device To list users on an Android device using ADB (Android Debug Bridge), you can use the following command: This command will display a list of users on the device, including their user IDs. For example, the output might look something like this: Configure the .csproj to launch the app on work profile Insert the following line within the <PropertyGroup> section of your .csproj file: This attribute specifies the user ID for the Android Work Profile. The user ID 10 is commonly used for work profiles, but you should verify this for your specific setup. Last but not least: Hit F5 and Run your project 🙂 Remark: This solution is only working in Visual Studio for Windows, and Visual Studio Code on mac.
Hi, I am András,
I am a seasoned software engineer from Budapest, Hungary with a strong focus on mobile app development using .NET MAUI and Xamarin.Forms. My expertise also extends to website building for my happy customers and other complex system designing. I am passionate about developing well-organized, maintainable software solutions.