Reputation: 1410
Method OnResume (_locationManager.RequestLocationUpdates) raises "Exception of type 'Java.Lang.Exception'" on Samsung Note 1 (works on SGS4).
Permissions: android.permission.ACCESS_FINE_LOCATION and android.permission.ACCESS_COARSE_LOCATION added.
Sources can be found on github: https://github.com/constructor-igor/sms2
[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();
}
}
added screen with full stack: http://cdn.vanillaforums.com/xamarin.vanillaforums.com/FileUpload/53/476688d11ac140e7c6aca6650348ce.png
Upvotes: 1
Views: 532
Reputation: 6201
The provider you are trying to use doesn't exist on that device.
You can check out the reason for IllegalArgumentException
in the documentation
Upvotes: 1