Пример #1
0
        public void CheckStill()
        {
            if (activityIdentificationService == null)
            {
                activityIdentificationService = ActivityIdentification.getService(new Context());
            }

            if (pendingIntent != null)
            {
                removeActivityTransitionUpdates();
            }

            LocationBroadcast.SetListenActivityConversionEnabled(true);
            try {
                List transitions = new List();
                activityTransition.setActivityType(103);
                activityTransition.setConversionType(0);
                transitions.add(activityTransition.build().obj);
                activityTransition.setActivityType(103);
                activityTransition.setConversionType(1);
                transitions.add(activityTransition.build().obj);
                pendingIntent             = getPendingIntent();
                activityTransitionRequest = new ActivityConversionRequest(transitions);
                Task task = activityIdentificationService.createActivityConversionUpdates(activityTransitionRequest, pendingIntent);
                task.addOnSuccessListener(new LocationSuccessListener((o) =>
                {
                    TestTip.Inst.ShowText("createActivityConversionUpdates onSuccess");
                })).addOnFailureListener(new HmsFailureListener((o) =>
                {
                    TestTip.Inst.ShowText("createActivityConversionUpdates exception");
                }));
            } catch (System.Exception e) {
                TestTip.Inst.ShowText("createActivityConversionUpdates exception:" + e.StackTrace);
            }
        }
 public void RequestActivity()
 {
     LocationBroadcast.SetActivityEnabled(true);
     activityIdentificationService = ActivityIdentification.getService(new UnityPlayerActivity());
     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");
     }));
 }