public override void OnLocationAvailability(LocationAvailability locationAvailability) { if (locationAvailability != null) { bool flag = locationAvailability.IsLocationAvailable; LocationLog.Info(TAG, "onLocationAvailability isLocationAvailable:" + flag); } }
public override void OnLocationResult(LocationResult locationResult) { if (locationResult != null) { IList <Android.Locations.Location> locations = locationResult.Locations; if (locations.Count != 0) { foreach (Android.Locations.Location location in locations) { LocationLog.Info(TAG, "onLocationResult location[Longitude,Latitude,Accuracy]:" + location.Longitude + "," + location.Latitude + "," + location.Accuracy); } } } }
public static void RequestActivityPermission(Context context) { if (Build.VERSION.SdkInt <= BuildVersionCodes.P) { if (ActivityCompat.CheckSelfPermission(context, "com.huawei.hms.permission.ACTIVITY_RECOGNITION") == Permission.Denied) { string[] permissions = { "com.huawei.hms.permission.ACTIVITY_RECOGNITION" }; ActivityCompat.RequestPermissions((Activity)context, permissions, 1); LocationLog.Info(TAG, "requestActivityTransitionButtonHandler: apply permission"); } } else { if (ActivityCompat.CheckSelfPermission(context, "android.permission.ACTIVITY_RECOGNITION") == Permission.Denied) { string[] permissions = { "android.permission.ACTIVITY_RECOGNITION" }; ActivityCompat.RequestPermissions((Activity)context, permissions, 2); LocationLog.Info(TAG, "requestActivityTransitionButtonHandler: apply permission"); } } }
public void OnSuccess(Java.Lang.Object locObj) { LocationLog.Info(TAG, "removeLocatonUpdatesWithCallback onSuccess"); }