Ejemplo n.º 1
0
 protected override void OnPause()
 {
     base.OnPause();
     //Unregister the intent reciever when the app goes to background.
     if (scanTech == VALUE_PREF_SCAN_DATAWEDGE)
     {
         UnregisterReceiver(receiver);
     }
     LogoutTimerUtility.StopLogoutTimer();
 }
Ejemplo n.º 2
0
        protected override void OnResume()
        {
            base.OnResume();
            // read preferences
            ISharedPreferences sharedPref = PreferenceManager.GetDefaultSharedPreferences(this);

            scanTech = sharedPref.GetString(KEY_PREF_SCAN_TECHNOLOGY, VALUE_PREF_SCAN_NONE);
            if (scanTech == VALUE_PREF_SCAN_NONE)
            {
                Snackbar.Make(FindViewById(Resource.Id.fab),
                              "Please select scanning technology!", Snackbar.LengthLong)
                .SetAction(Resource.String.action_settings, view =>
                {
                    Intent intent = new Intent(view.Context, typeof(SettingsActivity));
                    intent.PutExtra(PreferenceActivity.ExtraShowFragment,
                                    // typeof(SettingsActivity.ScannerPreferenceFragment).Name
                                    "TechStoreX.SettingsActivity.ScannerPreferenceFragment");
                    intent.PutExtra(PreferenceActivity.ExtraNoHeaders, true);
                    StartActivity(intent);
                }).Show();
            }
            //if (useDataWedge) {
            else if (scanTech == VALUE_PREF_SCAN_DATAWEDGE)
            {
                //Register for the intent to receive the scanned data using intent callback.
                //The action and category name used must be same as the names used in the profile creation.
                IntentFilter filter = new IntentFilter();
                filter.AddAction(PackageName + ".SCAN");
                filter.AddCategory(Intent.CategoryDefault);
                RegisterReceiver(receiver, filter);
            }
            // check permissions in runtime
            if ((int)Android.OS.Build.VERSION.SdkInt >= 23)
            {
                RequestPermissions();
            }
            // set up logout timer
            logoutTime = int.Parse(sharedPref.GetString(KEY_PREF_TIMEOUT, VALUE_PREF_TIMEOUT_DEFAULT));
            LogoutTimerUtility.StartLogoutTimer(this, this, logoutTime);
        }
Ejemplo n.º 3
0
 public override void OnUserInteraction()
 {
     base.OnUserInteraction();
     LogoutTimerUtility.StartLogoutTimer(this, this, logoutTime);
 }