public void OnMapReady(GoogleMap googleMap) { GMap = googleMap; if (Selected != null) { // There's been a point added already! MarkerOptions opts = new MarkerOptions(); opts.SetPosition(new LatLng(Selected.Lat, Selected.Long)); GMap.Clear(); GMap.AddMarker(opts); } string permission = global::Android.Manifest.Permission.AccessFineLocation; Permission currentPerm = ContextCompat.CheckSelfPermission(this, permission); if (currentPerm != Permission.Granted) { AndroidUtils.CheckGetPermission(permission, this, permRequestCode, Resources.GetString(Resource.String.permissionLocationTitle), Resources.GetString(Resource.String.permissionLocationExplanation)); } else { GetLocation(); } }
private void ChooseFileBtn_Click(object sender, EventArgs e) { new global::Android.Support.V7.App.AlertDialog.Builder(this) .SetMessage(Resource.String.createNewListenPopUp) .SetPositiveButton(Resource.String.createNewListenNew, (a, b) => { string permission = global::Android.Manifest.Permission.RecordAudio; Permission currentPerm = ContextCompat.CheckSelfPermission(this, permission); if (currentPerm != Permission.Granted) { AndroidUtils.CheckGetPermission(permission, this, PermReqCode, base.Resources.GetString(Resource.String.permissionMicTitle), base.Resources.GetString(Resource.String.permissionMicExplanation)); } else { StartRecordIntent(); } }) .SetNegativeButton(Resource.String.createNewListenExisting, (a, b) => { Intent intent = new Intent(); intent.SetAction(Intent.ActionGetContent); intent.SetType("audio/mpeg"); base.StartActivityForResult(Intent.CreateChooser( intent, new Java.Lang.String(base.Resources.GetString(Resource.String.createNewListenAudioBtn))), ExistingReqCode); }) .Show(); }
/// <summary> /// Launch image source picker intent, after trying to get permission for camera /// </summary> private void TakeChoosePhoto() { string permission = global::Android.Manifest.Permission.Camera; Permission currentPerm = ContextCompat.CheckSelfPermission(this, permission); if (currentPerm != Permission.Granted) { AndroidUtils.CheckGetPermission(permission, this, permRequestCode, Resources.GetString(Resource.String.permissionCameraTitle), Resources.GetString(Resource.String.permissionPhotoExplanation)); } else { FirePhotoIntent(currentPerm == Permission.Granted); } }
private void ImageView_Click(object sender, EventArgs e) { UpdateFiles(); string permission = global::Android.Manifest.Permission.Camera; Permission currentPerm = ContextCompat.CheckSelfPermission(this, permission); if (currentPerm != Permission.Granted) { AndroidUtils.CheckGetPermission(permission, this, PermRequestCode, Resources.GetString(Resource.String.permissionCameraTitle), Resources.GetString(Resource.String.permissionPhotoExplanation)); } else { FirePhotoIntent(currentPerm == Permission.Granted); } }