Ejemplo n.º 1
0
        public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
        {
            try
            {
                if (AppStatus.UserLogged == null)
                {
                    MyTrapBDConfig.Initialize();

                    AppStatus.UserLogged = UserApiService.GetUserLogged();
                }

                if (AppStatus.UserLogged != null)
                {
                    Token = AppStatus.UserLogged.Token;

                    apiClient = new GoogleApiClient.Builder(Context, this, this).AddApi(LocationServices.API).Build();

                    locRequest = new LocationRequest();

                    apiClient.Connect();

                    IsStarted = true;
                }
                else
                {
                    StopSelf();
                }
            }
            catch (Exception exception)
            {
                InsightsUtils.LogException(exception);
            }

            return(StartCommandResult.Sticky);
        }
Ejemplo n.º 2
0
        public override void OnReceive(Context context, Intent intent)
        {
            //Toast.MakeText(context, intent.Action, ToastLength.Long).Show();

            try
            {
                if (AppStatus.UserLogged == null)
                {
                    MyTrapBDConfig.Initialize();

                    AppStatus.UserLogged = UserApiService.GetUserLogged();
                }

                if (AppStatus.UserLogged != null)
                {
                    PositionService.Start(context);
                }
            }
            catch (Exception exception)
            {
                InsightsUtils.LogException(exception);
            }
        }
Ejemplo n.º 3
0
        protected override void OnCreate(Bundle bundle)
        {
            ActionBar.Hide();

            base.OnCreate(bundle);

            Xamarin.Forms.Forms.Init(this, bundle);

            MyTrapBDConfig.Initialize();

            SetContentView(MyTrap.Droid.Resource.Layout.activity_splash);

            AppStatus.Language = Locale.Default.ToString();

            AppStatus.Platform = Models.Enums.EPlatform.ANDROID;

            Thread thread = new Thread(() =>
            {
                LoadUser();
            });

            thread.Start();
        }