RequestLocationUpdates抛出Java.Lang.Exception
方法OnResume(\u locationManager.RequestLocationUpdate)在Samsung Note 1(适用于SGS4)上引发“类型为'Java.Lang.Exception'的异常” 权限:添加了android.permission.ACCESS\u FINE\u位置和android.permission.ACCESS\u rough\u位置 可以在github上找到源: 添加了具有完整堆栈的屏幕:RequestLocationUpdates抛出Java.Lang.Exception,java,android,xamarin,locationmanager,Java,Android,Xamarin,Locationmanager,方法OnResume(\u locationManager.RequestLocationUpdate)在Samsung Note 1(适用于SGS4)上引发“类型为'Java.Lang.Exception'的异常” 权限:添加了android.permission.ACCESS\u FINE\u位置和android.permission.ACCESS\u rough\u位置 可以在github上找到源: 添加了具有完整堆栈的屏幕: 您尝试使用的提供商在该设备上不存在。 您可以在seem\u l
您尝试使用的提供商在该设备上不存在。
您可以在seem\u locationProvider=String中检查
IllegalArgumentException
的原因。空和RequestLocationUpdates失败。现在我试着在Galaxy Note I上测试这个版本。谢谢。
[Activity (Label = "sms2", MainLauncher = true)]
public class MainActivity : Activity, ILocationListener
{
...
private LocationManager _locationManager;
...
protected override void OnCreate (Bundle bundle)
{
...
_locationManager = (LocationManager)GetSystemService(LocationService);
}
protected override void OnResume()
{
try
{
Log.Debug ("OnResume", "");
base.OnResume ();
m_smsSentBroadcastReceiver = new SMSSentReceiver();
m_smsDeliveredBroadcastReceiver = new SMSDeliveredReceiver();
RegisterReceiver(m_smsSentBroadcastReceiver, new IntentFilter("SMS_SENT"));
RegisterReceiver(m_smsDeliveredBroadcastReceiver, new IntentFilter("SMS_DELIVERED"));
_locationManager.RequestLocationUpdates(_locationProvider, 0, 0, this);
}
catch(Exception e) {
Toast.MakeText(Application.Context, String.Format("OnResume failed, becasue '{0}'", e.Message), ToastLength.Long).Show();
}
}