A Microsoft framework for building cross-platform mobile apps using .NET and C# with native performance and user interfaces.
AddCapability(NetCapability.Mcx) issue Java.Lang.SecurityException: 'ConnectivityService: user 10132 has no permission to access restricted network.'
Executes the following code in xamarin.
When I set .AddCapability(NetCapability.Supl) to Supl
Or when I have .AddCapability(NetCapability.Mms) on mms
This phone app works. But when I insert .AddCapability(NetCapability.Mcx) the app crashes and won't work.
I don't know why, is it a permissions issue?
But what if I have already marked everything in the manifest and in the android settings I have also assigned everything to the application?
Anyone got any ideas?
The API is set to 33
All latest versions
var context = Android.App.Application.Context;
Android.Provider.Settings.System.CanWrite(context);
NetworkRequest request = new NetworkRequest.Builder()
.AddTransportType(Android.Net.TransportType.Cellular)
.AddCapability(NetCapability.Supl)
.Build();
ConnectivityManager connectivityManager = (ConnectivityManager)context.GetSystemService(Android.Content.Context.ConnectivityService);
MyNetworkCallback networkCallback = new MyNetworkCallback();
connectivityManager.RequestNetwork(request, networkCallback);
private class MyNetworkCallback : ConnectivityManager.NetworkCallback
{
public override void OnAvailable(Network network)
{
base.OnAvailable(network);
}
public override void OnLost(Network network)
{
base.OnLost(network);
}
}
When i set "Mcx" not "Supl" or "MMS" and run application
.AddCapability(NetCapability.Mcx)
Visual studio return this error, why?
Java.Lang.SecurityException: 'ConnectivityService: user 10132 has no permission to access restricted network.'
What permissions do I need to be able to execute the code with the Mcx parameter?