本文整理汇总了C#中Android.Locations.LocationManager.GetProvider方法的典型用法代码示例。如果您正苦于以下问题:C# LocationManager.GetProvider方法的具体用法?C# LocationManager.GetProvider怎么用?C# LocationManager.GetProvider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Locations.LocationManager
的用法示例。
在下文中一共展示了LocationManager.GetProvider方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartService
public void StartService()
{
_locMan = Application.Context.GetSystemService (Context.LocationService) as LocationManager;
if (_locMan.GetProvider (LocationManager.GpsProvider) != null && _locMan.IsProviderEnabled (LocationManager.GpsProvider))
{
_pi = PendingIntent.GetBroadcast(Application.Context, 0, new Intent(), PendingIntentFlags.UpdateCurrent);
_locMan.RequestLocationUpdates(LocationManager.GpsProvider, 2000, 5, _pi);
_locMan.GetLastKnownLocation (LocationManager.GpsProvider);
}
else
throw new GPSNotEnabledException (Const.NO_GPS_ERROR_MESSAGE);
}
示例2: getLoc
public Location getLoc()
{
locMgr = context.GetSystemService(Context.LocationService) as LocationManager;
Criteria criteria = new Criteria();
LocationProvider provider = locMgr.GetProvider("network");
Location location = locMgr.GetLastKnownLocation(provider.Name);
return location;
}