public override void OnReceive(Context context, Intent intent)
        {
            Bundle b             = intent.GetBundleExtra("sensor_data");
            var    accVector     = b.GetFloatArray("accVector");
            var    orientVector  = b.GetFloatArray("orientVector");
            var    broadcast_idx = b.GetInt("broadcast_idx");

            TrackingActivity.GetInstace().UpdateSensorEntries(broadcast_idx, accVector, orientVector);
        }
        public override void OnReceive(Context context, Intent intent)
        {
            TrackingActivity.GetInstace().isStarted = false;
            TrackingActivity.GetInstace().switchServiceButton.LeftIconDrawable = (TrackingActivity.GetInstace().startIcon);
            TrackingActivity.GetInstace().switchServiceButton.Text = TrackingActivity.GetInstace().GetText(Resource.String.start);
            Bundle b = intent.GetBundleExtra("report");
            var    wasSuccess = b.GetBoolean("SavingSuccessful", false);

            TrackingActivity.GetInstace().ShowSnackOnFinish(wasSuccess);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
            myInstance = this;
            SetContentView(Resource.Layout.TrackingActivityLayout);
            OnNewIntent(Intent);
            if (savedInstanceState != null)
            {
                isStarted = savedInstanceState.GetBoolean(Constants.SERVICE_STARTED_KEY, false);
            }

            startServiceIntent = new Intent(this, typeof(SensorTrackingService));
            startServiceIntent.SetAction(Constants.ACTION_START_SERVICE);

            stopServiceIntent = new Intent(this, typeof(SensorTrackingService));
            stopServiceIntent.SetAction(Constants.ACTION_STOP_SERVICE);

            switchServiceButton        = FindViewById <FloatingTextButton>(Resource.Id.start_service_button);
            switchServiceButton.Click += SwitchService_Click;

            mCoordinator = FindViewById <CoordinatorLayout>(Resource.Id.coordinator);

            //AnimatedVectorDrawableCompat aa= AnimatedVectorDrawableCompat.Create(this,Resource.Drawable;
            startIcon = VectorDrawableCompat.Create(Resources, Resource.Drawable.ic_play, Theme);
            stopIcon  = VectorDrawableCompat.Create(Resources, Resource.Drawable.ic_stop, Theme);

            if (isStarted)
            {
                switchServiceButton.Text             = GetText(Resource.String.stop);
                switchServiceButton.LeftIconDrawable = (stopIcon);
            }
            else
            {
                switchServiceButton.LeftIconDrawable = (startIcon);
                switchServiceButton.Text             = GetText(Resource.String.start);
            }

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            if (toolbar != null)
            {
                SetSupportActionBar(toolbar);
                SupportActionBar.SetDisplayShowHomeEnabled(true);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            }
            mySensorDataReceiver = new XYZDataReceiver();
            myStopSignalReceiver = new StopSignalReceiver();
            LocalBroadcastManager.GetInstance(this).RegisterReceiver(mySensorDataReceiver, new IntentFilter("SensorBroadcast"));
            LocalBroadcastManager.GetInstance(this).RegisterReceiver(myStopSignalReceiver, new IntentFilter("StoppingSignal"));
        }