runtime-permissions

Is the request for internet persmission required at runtime (Android)?

你说的曾经没有我的故事 提交于 2019-12-08 17:30:35
问题 For Android, it is required that we ask permissions at runtime to make sure users understand better why en when permissions are needed. I know this is true for permissions like WRITE_CALENDAR and ACCESS_FINE_LOCATION but it seems it's not required for INTERNET. Not strange because almost all apps use internet. Is it safe to say that I only need to declare it in the manifest? <uses-permission android:name="android.permission.INTERNET" /> Or should I always check it at runtime? 回答1: No, you

Deny permission on Splash screen but again ask for allow permission prompt in another activity

落花浮王杯 提交于 2019-12-08 11:34:52
问题 if (Build.VERSION.SDK_INT >= 23) { if (checkPermission()) { Log.e("permission", "Permission already granted."); } else { requestPermission(); } } private boolean checkPermission() { int result = ContextCompat.checkSelfPermission(SolutionBrouchereActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE); if (result == PackageManager.PERMISSION_GRANTED) { viewOrDownloadPDF(); return true; } else { return false; } } private void requestPermission() { ActivityCompat.requestPermissions(getParent(

Storage permission restarts application

依然范特西╮ 提交于 2019-12-08 08:21:12
问题 I have a launcher application which runs on a custom firmware(have only Camera , Settings , Chrome & Explorer). The problem come when we ask user (runtime permission) for Manifest.permission.WRITE_EXTERNAL_STORAGE on denying the permission onRequestPermissionsResult gets called but on allowing the permission application restarts. This is not happening for Manifest.permission.CAMERA permission. I can't find any proper logs pointing to this issue. The same issue is happening for the above

Start the Activity After Multiple Permission?android 6+

落花浮王杯 提交于 2019-12-06 10:16:45
问题 I have Given this to Req Multiple permission at my splash screen public class Main_MulPer extends Activity { public static final int R_PERM = 321; Context context = this; public static boolean hasPermissions(Context context, String... permissions) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && context != null && permissions != null) { for (String permission : permissions) { if (ActivityCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) { return

checkSelfPermission() doesn't seem to work for WRITE_EXTERNAL_STORAGE

牧云@^-^@ 提交于 2019-12-06 03:42:32
I have the app that uses <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> It's automatically granted on Android 6.0, but I can revoke it in the settings. Wanted to check if it's granted in case user revokes it, so I do this: int permissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE); if (permissionCheck == PackageManager.PERMISSION_GRANTED) { //OK permission granted, let's do stuff } else { //I'll better ask for permission } Funny thing is that the condition is ALWAYS fulfilled, even the permission was revoked manually.

targetSdkVersion 23 returns 0 length array via accountManager.getAccounts()

跟風遠走 提交于 2019-12-06 01:15:25
问题 I observed the following strange outcome in my real Nexus 5 device, Android 6.0.1 I run the following simple code during my app launched. Pattern emailPattern = Patterns.EMAIL_ADDRESS; // API level 8+ AccountManager accountManager = AccountManager.get(this); Account[] accounts = accountManager.getAccounts(); The above code works fine, if I set my targetSdkVersion to 22, 21, 19. It returns non empty array. However, when I change targetSdkVersion and tested with defaultConfig { applicationId

Request Permission after selected option(either camera or gallery) from intent chooser in android

拥有回忆 提交于 2019-12-05 10:38:06
问题 I have created an intent chooser containing Gallery, Photos and Camera apps. Now for the devices running on Android 6.0 or greater I want to ask the run time permissions after app is selected from chooser like if user selects gallery option I will ask storage permission only and in case if user select camera option I will ask camera and storage both permissions if not given before. Can someone help me to do so? Here is my code public void openImageIntent() { File storageDir = Environment

Xamarin – Cannot override OnRequestPermissionsResult

谁说胖子不能爱 提交于 2019-12-05 04:47:44
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[] permissions, Permission[] grantResults ) { } } } How can I use the new Marshmallow permissions in

targetSdkVersion 23 returns 0 length array via accountManager.getAccounts()

本秂侑毒 提交于 2019-12-04 05:15:35
I observed the following strange outcome in my real Nexus 5 device, Android 6.0.1 I run the following simple code during my app launched. Pattern emailPattern = Patterns.EMAIL_ADDRESS; // API level 8+ AccountManager accountManager = AccountManager.get(this); Account[] accounts = accountManager.getAccounts(); The above code works fine, if I set my targetSdkVersion to 22, 21, 19. It returns non empty array. However, when I change targetSdkVersion and tested with defaultConfig { applicationId "org.yccheok.myapplication" minSdkVersion 19 targetSdkVersion 23 versionCode 1 versionName "1.0" } The

Android Marshmallow Location Permission handling

江枫思渺然 提交于 2019-12-04 02:11:26
问题 I am working on Android Marshmallow runtime permissions. I asked user for location permission, suppose he has allowed to get the location and i have started getting location but now user has denied the permission from settings of application. Now application has crashed. How can i handle it? Please help. 回答1: This is worked for me !!! In Your Splash Activity of your application do the following, Note: If user disables the permission after some time, these piece of code will not allow to get