Hello,
Welcome to our Microsoft Q&A platform!
but how can I determine if the user is on Huawei AppGallery
For this function, please try to detect the manufacture of the build device on the native Android. You could use DependencyService to invoke native platform functionality from shared code.
1.Create an interface for the native platform functionality in the shared project.
namespace TestApplication
{
public interface ITestInterface
{
string getPath();
}
}
2.Implement the interface in the required platform projects and register the platform implementations.
[assembly: Xamarin.Forms.Dependency(typeof(TestImplementation))]
namespace TestApplication.Droid
{
public class TestImplementation : ITestInterface
{
public string getManufacturer()
{
string deviceMan = Android.OS.Build.Manufacturer; ;
return deviceMan;
}
}
}
3.Consume the code in the shared project to the get manufacture of the build device.
var deviceMan = DependencyService.Get<ITestInterface>().getManufacturer();
if (deviceMan == "HUAWEI")
{
//perform the work
}
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
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.