runtime-permissions

When asking for runtime permission for location

雨燕双飞 提交于 2019-12-12 14:23:32
问题 Currently when asking for run time permission when launching my app for the very first time it prompts the user to use their location. And if you click yes it doesn't enable location like it should. But if I relaunch the app it enables the location. Any suggestions as to where I can get it to have location enabled on first launch ? The first part of the code is called in OnCreate. if (ContextCompat.checkSelfPermission(MapsActivity.this, Manifest.permission.ACCESS_FINE_LOCATION) !=

On Map Fine Location Permission Denied Go To Custom Location

落花浮王杯 提交于 2019-12-11 14:52:49
问题 I am making an app that uses maps API. What I want is to make a permission popup. When the user clicks allow it should zoom in to his current location. Now I want to decide what happens if he doesn't want to allow this. If he denies this permission map should zoom to the custom location, but in never goes there and it doesn't show the toast. My maps fragment looks like this : REQUESTING PERMISSION HERE: mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(GoogleMap

Require dangerous permissions during installation

我们两清 提交于 2019-12-11 10:49:17
问题 Since API level 23, android introduced a new approach to grant 'dangerous' permissions , while the app is running. That means that permissions such as camera access, phone call access and such will have to be given during run time. I can completely understand why this can often be very useful, and less intimidating to users in the installation process. However, an app which uses many such 'dangerous' permissions (for all the right reasons) can easily annoy a user with so many requests in

Requesting Location Permission at Runtime

巧了我就是萌 提交于 2019-12-11 10:05:57
问题 I have a query implementing RuntimePermission for Location . When I tried to requestLocationUpdates , I got LintError suggesting me to add PermissionCheck for that line. Considering that I implemented run-time permissions. So this is how it looks, if (isNetworkEnabled() && networkListener != null) { if (ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(context, Manifest.permission

Android does not show permission dialog for RECORD_AUDIO in android 6.0

会有一股神秘感。 提交于 2019-12-11 02:27:16
问题 Android does not show permission dialog for RECORD_AUDIO I have added the required permission in android manifest <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> and following code private boolean checkPermission() { int result = ContextCompat.checkSelfPermission(this, android.Manifest.permission.RECORD_AUDIO); if (result == PackageManager.PERMISSION_GRANTED) { return true; } else { return false; }

Activity.requestPermissions vs ActivityCompat.requestPermissions

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 00:56:32
问题 Runtime permission dialog is shown in Android 6.0 or higher, so Activity.requestPermissions(...) which was added in API level 23 makes sense. But why is there another one ( ActivityCompat.requestPermissions(...) ) to be used for below Android 6.0? Does this show runtime permission request dialog in lower versions? What is the difference between Activity.requestPermissions(permissions, requestCode) and ActivityCompat.requestPermissions(activity, permissions, requestCode) Which one should I use

Android: Check whether runtime permissions must be asked or not

為{幸葍}努か 提交于 2019-12-10 18:14:22
问题 I would like to check whether a particular app need to handle Android Marshmallow runtime permissions in runtime or not. Is it the following assumption correct? /** * Checks whether runtime permissions must be handled or not. * * @param context Application context. * @return Handle runtime permissions or not. */ public static boolean shouldCheckRuntimePermissions(Context context) { return isApplicationWithMarshmallowTargetSdkVersion(context) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;

How to ask permission (RunTime) again if the user deny for the first time

时间秒杀一切 提交于 2019-12-10 15:40:17
问题 I want to re ask the permission to the user in the situation if he/she deny for the first time. I have set the permission but my app runs even if I press deny option. I have a code which should do the things which I want to do but I get Cant resolve symbol Snackbar when I hit Alt+Enter it created another activity and remaining -make and -permision_available_camera gets red error. @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[]

Xamarin – Cannot override OnRequestPermissionsResult

早过忘川 提交于 2019-12-10 04:17:14
问题 I've got a class that extends Activity and implements IOnRequestPermissionsResultCallback . I want to use OnRequestPermissionResult and I coded it exactly as in XamarinBlog (section Handle Permission Request) and Monodroid Github but I always get no suitable method to override error. namespace App1 { class Aplication : Android.App.Activity, Android.Support.V4.AppActivityCompat.IOnRequestPermissionsResultCallback { public override async void OnRequestPermissionsResult( int requestCode, string[

How to avoid writing duplicate boilerplate code for requesting permissions?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-09 04:30:35
问题 I'm updating my app to be Android 6-compatible. The permission model is not very complex in theory, but now I'm in the process of implementing it and I find myself writing the same ugly boilerplate code in every one of my activities that require permissions. For every permission I need, there is a if (ActivityCompat.checkSelfPermission(this, Manifest.permission.PERMISSION) != PackageManager.PERMISSION_GRANTED) { } else { } and then in the onRequestPermissionsResult I have to check/filter the