Ejemplo n.º 1
0
        protected override void OnStart()
        {
            base.OnStart();

            if (!Utils.IsKitKatWithStepCounter(PackageManager))
            {
                Console.WriteLine("Not compatible with sensors, stopping service.");
                return;
            }

            if (!firstRun)
            {
                StartStepService();
            }

            if (IsBound)
            {
                return;
            }

            var serviceIntent = new Intent(this, typeof(StepService));

            serviceConnection = new StepServiceConnection(this);
            BindService(serviceIntent, serviceConnection, Bind.AutoCreate);
        }
Ejemplo n.º 2
0
        protected override void OnStart()
        {
            base.OnStart();
            if (!firstRun)
            {
                StartStepService();
            }

            if (IsBound)
            {
                return;
            }

            var serviceIntent = new Intent(this, typeof(StepCounter));

            serviceConnection = new StepServiceConnection(this);
            BindService(serviceIntent, serviceConnection, Bind.AutoCreate);
            StartStepService();
        }