0
我已经创建了位置跟踪应用程序。今天我还添加了Geofencing功能。我是简单的单身人士课程,当地理位置围绕着cooridnates时引发事件。Xamarin Android - 关于相关问题
当我手动提出事件,然后它按预期工作。但是,当我在坐标达到释放模式时设置停止应用程序。我有错误日志里面,每一个写的是: java.lang.reflect.InvocationTargetException
我正在使用MVVMCross库。我的视图模型附加到Geofencing服务类女巫回调。当用户到达cooridnate时,应该调用回调函数。正如我在调试中所说的那样工作。
下面的代码示例:
public class GeofenceService : IGeofenceService
{
//...
public event EventHandler<GeofenceStatusChangedEventArgs> StatusChanged;
//..
}
public abstract class GeofenceViewModel : BaseViewModel
{
protected IGeofenceService GeofenceService { get; }
protected virtual void StartMonitoring(AddressModel address, MonitoringRadius radius)
{
MonitoredAddress = address;
GeofenceService.StartMonitoring(new Location(address.Id, address.Latitude, address.Longitude), radius, GeofenceExpectation);
GeofenceService.Subscribe(this, OnStatusChanged);
}
protected void OnStatusChanged(object sender, GeofenceStatusChangedEventArgs e)
{
//...
}
}
有没有一种方法,我怎样才能得到真正的例外?
这行代码的人保存了很多我的时间。非常感谢 !! – miechooy