Exemple #1
0
 public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults)
 {
     base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
     if (requestCode == (int)Enums.RequestCode.PermissionsWriteExternalStorage && grantResults[0] == Permission.Granted)
     {
         Init();
     }
     else
     {
         if (PermissionHelpers.NeedPermissionsWriteExternalStorage(this))
         {
             var builder = new AlertDialog.Builder(this);
             builder.SetTitle("Need Permissions Write External Storage");
             builder.SetMessage("Without this permit application can not fully work");
             builder.SetCancelable(false);
             builder.SetPositiveButton("OK", delegate {
                 PermissionHelpers.RequestPermissionssWriteExternalStorage(this);
                 Finish();
             });
             builder.SetNegativeButton("Cansel", delegate
             {
                 Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
                 Finish();
             });
             builder.Show();
         }
         else
         {
             Init();
         }
     }
 }
Exemple #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            AndroidEnvironment.UnhandledExceptionRaiser += (sender, args) =>
            {
                System.IO.File.AppendAllText("tmp.txt", args.Exception.ToString());
            };

            AppDomain.CurrentDomain.UnhandledException += (s, e) =>
            {
                Toast.MakeText(this, "Test", ToastLength.Short).Show();
            };


            Window.RequestFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.Main);

            _shopping            = FindViewById <ImageButton>(Resource.Id.shopping);
            _shopping.Visibility = ViewStates.Gone;

            _trialImg            = FindViewById <ImageView>(Resource.Id.trialMainImg);
            _trialImg.Visibility = ViewStates.Invisible;

            _infoBoxControl    = (InfoBoxControl)FindViewById(Resource.Id.NewInfoBoxControl);
            mAdView            = FindViewById <Android.Gms.Ads.AdView>(Resource.Id.adView);
            mAdView.Visibility = ViewStates.Invisible;

            _MainLayout = (RelativeLayout)FindViewById(Resource.Id.main_layout);
            _MainImage  = (ImageView)FindViewById(Resource.Id.mainImgBase);
            _MainImage.SetScaleType(ImageView.ScaleType.CenterCrop);
            ShowDefImage();

            _timer = new System.Timers.Timer();

            if (PermissionHelpers.NeedPermissionsWriteExternalStorage(this))
            {
                PermissionHelpers.RequestPermissionssWriteExternalStorage(this);
            }
            else
            {
                Init();
            }
        }