Android 13 – READ_EXTERNAL_STORAGE_PERMISSION still usable

According to documentation (https://developer.android.com/training/data-storage/shared/media#storage-permission): No permissions needed if you only access your own media files On devices that run Android 10 or higher, you don’t need any storage-related permissions to access and modify media files that your app owns, including files in the Media Store. Downloads collection. If you’re developing a camera app, for example, … Read more

Can you request permissions synchronously in Android Marshmallow (API 23)’s runtime permissions model?

As of Marshmallow, my understanding is that you can’t. I had to solve the same issue in my app. Here’s how I did it: Refactoring: Move every chunk of code that depends on permissions of some kind into a method of its own. More refactoring: Identify the trigger for each method (such as starting an … Read more

checkSelfPermission method is not working in targetSdkVersion 22

If your application is targeting API level before 23 (Android M) then both: ContextCompat#checkSelfPermission and Context#checkSelfPermission won’t work and always return 0 (PERMISSION_GRANTED). Even if you run the application on Android 6.0 (API 23). It isn’t fully true that if you targeting API level before 23 then you don’t have to take care of permissions. … Read more

Latest update on enabling and disabling mobile data programmatically [duplicate]

It wont work on non-rooted phone as they added MODIFY_PHONE_STATE permission check. This permission is only given to system or signature apps refer-here. Check the code below from PhoneInterfaceManager: @Override public void setDataEnabled(boolean enable) { enforceModifyPermission(); mPhone.setDataEnabled(enable); } private void enforceModifyPermission() { mApp.enforceCallingOrSelfPermission(android.Manifest.permission.MODIFY_PHONE_STATE, null); }

How does storage access change on Android 6?

Let me answer Adoptable Storage Devices related questions: Suppose the user has chosen to use “Adoptable Storage Devices”, what does it mean for the various functions that retrieve the paths of the app’s files? For example : getFilesDir, getExternalFilesDir,… ? Would the oder of getExternalFilesDirs change because of it? When user choose to use SD … Read more

Permission Denial while sharing file with FileProvider [duplicate]

Sorry about the late response. I solved it like this: Intent chooser = Intent.createChooser(intentShareFile, “Share File”); List<ResolveInfo> resInfoList = this.getPackageManager().queryIntentActivities(chooser, PackageManager.MATCH_DEFAULT_ONLY); for (ResolveInfo resolveInfo : resInfoList) { String packageName = resolveInfo.activityInfo.packageName; this.grantUriPermission(packageName, uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); } startActivity(chooser); This helped me: Permission Denial with File Provider through intent

How to check if Android Permission is actually being used?

In Android Studio 1.3 & Android Support Library v7:22.2.0, you have solution for it. Steps: Update Android Studio to V1.3 Update your Android Support Library to v7:22.2.0 Run Android Lint (Analyse -> Inspect Code), In Lint Error see for Type “Android -> Constant & Resource Type MisMatch”, Which shows all methods which requires permission. Explanation … Read more

How to check Grants Permissions at Run-Time?

You can use the following code copied from https://android.googlesource.com/platform/frameworks/base/+blame/71c2c37554ae53dffdf8e210f484d92af30620fa/docs/html/preview/features/runtime-permissions.jd?pli=1#548 — Request permissions if necessary if (checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) { requestPermissions(new String[]{Manifest.permission.READ_CONTACTS}, MY_PERMISSIONS_REQUEST_READ_CONTACTS); // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an // app-defined int constant return; } Handle the permissions request response @Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { case MY_PERMISSIONS_REQUEST_READ_CONTACTS: { if (grantResults[0] … Read more

SecurityException: not allowed to perform OP_READ_PHONE_STATE

Looking for that method in AOSP eventually leads to the cheakReadPhoneState() method. In Android 6, that method was here. In both cases, it looks pretty similar. Here’s the Android 6 code: private boolean checkReadPhoneState(String callingPackage, String message) { try { mContext.enforceCallingOrSelfPermission( android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, message); // SKIP checking run-time OP_READ_PHONE_STATE since self or using PRIVILEGED return true; … Read more

How to check MIUI autostart permission programmatically?

For now it’s not possible. As it’s completely depend on their operating system API’s and customisation. Even developers have requested for this on XIOMI’s official forums but there is no response from there side. Till now even i am finding an answer to this question but nothing helped me. For the time being it will … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)