Esempio n. 1
0
 public void SetPermission()
 {
     LocationCommon.SetPermission(
         new string[] { ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION },
         new string[] { ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION, ACCESS_BACKGROUND_LOCATION }
         );
 }
Esempio n. 2
0
        public void RemoveUpdates()
        {
            Task task = null;

            switch (requestType)
            {
            case CALLBACK:
                task = mFusedLocationProviderClient.removeLocationUpdates(mLocationCallback);
                break;

            case INTENT:
                task = mFusedLocationProviderClient.removeLocationUpdates(LocationCommon.GetPendingIntent());
                break;

            case LocationHD:
                task = mFusedLocationProviderClient.removeLocationUpdates(mLocationCallback);
                break;;
            }

            if (task != null)
            {
                task.addOnSuccessListener(new LocationSuccessListener((AndroidJavaObject o) =>
                {
                    TestTip.Inst.ShowText("remove update success");
                }))
                .addOnFailureListener(new HmsFailureListener((Exception e) =>
                {
                    TestTip.Inst.ShowText("remove update failure");
                }));
            }
        }
Esempio n. 3
0
 public void RequestActivityPermission()
 {
     LocationCommon.SetPermission(
         new string[] { "com.huawei.hms.permission.ACTIVITY_RECOGNITION" },
         new string[] { "android.permission.ACTIVITY_RECOGNITION" }
         );
 }
Esempio n. 4
0
 public void RequestActivity()
 {
     LocationBroadcast.SetActivityEnabled(true);
     activityIdentificationService = ActivityIdentification.getService(new Activity());
     activityIdentificationService.createActivityIdentificationUpdates(5000, LocationCommon.GetPendingIntent())
     .addOnSuccessListener(new LocationSuccessListener((AndroidJavaObject o) => {
         TestTip.Inst.ShowText("activity success");
     }))
     .addOnFailureListener(new HmsFailureListener((Exception e) => {
         TestTip.Inst.ShowText("activity failure");
     }));
 }
Esempio n. 5
0
 public void SetIntentSuccess()
 {
     mFusedLocationProviderClient
     .requestLocationUpdates(mLocationRequest, LocationCommon.GetPendingIntent())
     .addOnSuccessListener(new LocationSuccessListener((AndroidJavaObject o) =>
     {
         TestTip.Inst.ShowText("set intent success");
     }))
     .addOnFailureListener(new HmsFailureListener((Exception e) =>
     {
         TestTip.Inst.ShowText("set intent fail");
     }));
 }
Esempio n. 6
0
 public void RemoveRunning()
 {
     LocationBroadcast.SetActivityEnabled(false);
     activityIdentificationService.deleteActivityIdentificationUpdates(LocationCommon.GetPendingIntent());
 }