public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults) { if (!CameraPermissionHelper.HasCameraPermission(this)) { Toast.MakeText(this, "Camera permission is needed to run this application", ToastLength.Long).Show(); Finish(); } }
protected override void OnResume() { base.OnResume(); // ARCore requires camera permissions to operate. If we did not yet obtain runtime // permission on Android M and above, now is a good time to ask the user for it. if (CameraPermissionHelper.HasCameraPermission(this)) { ShowLoadingMessage(); // Note that order matters - see the note in onPause(), the reverse applies here. mSession.Resume(mDefaultConfig); mSurfaceView.OnResume(); } else { CameraPermissionHelper.RequestCameraPermission(this); } }