protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Forms.SetFlags("CollectionView_Experimental"); Forms.Init(this, savedInstanceState); FormsMaterial.Init(this, savedInstanceState); _ = new AppBootstrapper(); if (Locator.Current.GetService <IEmpaticaHandler>() is EmpaticaHandler empaticaHandler) { empaticaHandler.RequestBluetoothAction = () => { var enableBtIntent = new Intent(BluetoothAdapter.ActionRequestEnable); StartActivityForResult(enableBtIntent, RequestEnableBt); } } ; if (ApplicationContext.CheckCallingOrSelfPermission( Manifest.Permission.AccessCoarseLocation) != Permission.Granted) { ActivityCompat.RequestPermissions(this, new[] { Manifest.Permission.AccessCoarseLocation }, RequestPermissionAccessCoarseLocation); } LoadApplication(new App()); }
protected override void OnCreate(Bundle savedInstanceState) { //bool permissionGranted = ActivityCompat.CheckSelfPermission(this, Manifest.Permission.AccessFineLocation) == PackageManager.PERMISSION_GRANTED; //if (ApplicationContext.CheckCallingOrSelfPermission(Android.Manifest.Permission.AccessFineLocation) == Android.Content.PM.Permission.Granted) //{ //} bool permissionGranted = ApplicationContext.CheckCallingOrSelfPermission(Android.Manifest.Permission.AccessFineLocation) == Android.Content.PM.Permission.Granted; if (permissionGranted) { // {Some Code} } else { ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.AccessFineLocation }, 1); } TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; Xamarin.FormsMaps.Init(this, savedInstanceState); base.OnCreate(savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); LoadApplication(new App()); }