Android Studio complains about missing permission check for Fingerprint sensor - android

I have the following code-lines:
FingerprintManager fm = activity.getSystemService(FingerprintManager.class);
fm.isHardwareDetected();
At this Point, Android Studio complains about a missing permssionCheck (checkSelfPermission).
Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with checkPermission) or explicitly handle a potential SecurityException
However, as I understand the Documentation, USE_FINGERPRINT (required by FingerprintManager) is not a "dangerous" permission and thus is granted at install time. If I suppress the AndroidStudio warning everything works fine on my test devices.
Is this a bogus warning?

Did you add the permission to your Manifest file already? You don't need to request the permission at runtime, but you still need to have the manifest entry.

This clearly seems to be an AndroidStudio bug. I have added
//noinspection MissingPermission
to supress this warning, and there are no negative consequences.

Related

Android Studio ignoring Manifest uses-permission entries

I am trying to show my location on a GoogleMap but Android Studio reports a fatal error on the following line
savedGoogleMap.isMyLocationEnabled = true
The error message is
Missing permissions required by GoogleMap.setMyLocationEnabled: android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION
The problem is the manifest file already includes both permissions so they are not missing!
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Using the IDE context actions to add the permissions inserts additional .ACCESS___LOCATION to the manifest file but Android Studio still reports the fatal error
The apparent issue is Android Studio is ignoring permissions included in the manifest
Earlier posts e.g. here highlight the need for runtime permission checks
My App checks for the required permissions and if checkSelfPermission is not granted I then request the required permissions
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)
So at this moment my app shows a fatal error but there appears no way to fix it
Can anyone suggest other avenues I might try ?
Update
Despite the fatal error the App builds and launches? It also shows myLocation on the Google map.
My problem is the manifest file already includes both permissions!
That's not the problem. It is totally fine to have both permissions declared in your AndroidManifest.xml file, just make sure they are added in the correct place like so
After you double checked on that one, make sure you you not only call checkSelfPermission, but also requestPermissions like this:
After receiving the result proceed with your calls (or if the permission was already granted).
If you are positive with this so far and still no success, it would seem to me that something else is causing the problem and I would look into the configuration files, library dependency, caches etc.

Uploading the Apk in google playstore getting warnings related location

In Application i haven't using the location but while uploading the application in playstore i am getting below warning, recently i implemented In-app updates, as per my knowledge in-app updates not required location permission.
Screenshot of warnings
New Permission Added warning: use that have the APK with version code 20 may need to accept the android.permision.ACCESS_FINE_LOCATION permission, which may result in them not upgrading to this version of the app
Tip : Ensure that the new permissions are necessary, and consider mentioning these permissions in the What's new in the release text
This permission must be coming from any of your dependencies. to check where it's coming from open your AndroidManifest.xml file and click on the merged manifest tab to see final Manifest version after merging all manifest from dependency. you can even check every dependencies manifest my clicking on the library name on the left-hand side.
Refer to the image
as per your screenshot location permission is detected in v21.
message from apk v21-
Check your manifest again and ensure there is not ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION or any other location related permission you have mentioned.
do CTRL + SHIFT + S and type location see if you find anything related location.
message from apk v20- because you have increased minSdkVersion to a higher number.

Trying to remove Android SMS and CALL_LOG permissions per Play Console, but can't find them

The Play Dev Console warns me that my app will be impacted by a policy change governing the use of SMS and CALL_LOG permissions, however I can't find that those permissions are used in my app. Here are the permissions the app uses, which I verified by opening the APK in Android Studio and reviewing AndroidManifest.xml:
com.google.android.c2dm.permission.RECEIVE
android.permission.RECEIVE_BOOT_COMPLETED
android.permission.INTERNET
android.permission.GET_ACCOUNTS
android.permission.WAKE_LOCK
android.permission.READ_CONTACTS
android.permission.WRITE_CONTACTS
android.permission.VIBRATE
android.permission.WRITE_SETTINGS
android.permission.ACCESS_FINE_LOCATION
android.permission.ACCESS_NETWORK_STATE
android.permission.ACCESS_COARSE_LOCATION
android.permission.USE_FINGERPRINT
Are any of the above triggers for the SMS or CALL_LOG permission? Relevant information: This is an old app that I'm trying hard not to need to recompile, although it may be unavoidable.
I had the same problem, to solve the problem I changed the binary of the internal test because I only had changed the production binary.
OK, I think I found the answer. In Google's permissions documentation, they say that the READ_CONTACTS permission is a trigger for the *_CALL_LOG permissions, and this happens only if your minSdkVersion and targetSdkVersion are <= 15. This describes my situation in this aging app, so my next step will be to either try to minimally tweak it and sign it, or else bite the bullet and modernize the whole build.

Adding the Layer library dependency in Android suppresses requestPermissions dialog

I made a very, very small demo app reproducing the bug on a Nexus 5 running Android version 6.0.1. The app is on github here: https://github.com/lexi-sr/LayerPermission
I recently added 2 commits in which it targets API 23 and requests permissions at run time, but it still didn't work.
In these 2 commits, it has these settings:
Target SDK: 23
compiles Layer 0.20.3
1) In the commit "Removing layer dependency allows the popup dialog to request the perm…", where it does NOT have layer dependency:
The method ActivityCompat.requestPermissions opens a dialog that requests the Contacts permission, and a log statement within the onRequestPermissionsResult method logs that the permission has been granted.
2) In the commit "Requesting permissions does not work" where it DOES have layer dependency:
ActivityCompat.requestPermissions does not open up any dialogs, but a log statement within onRequestPermissionsResult still prints, logging that it does not have the permission.
It seems like adding the layer dependency is suppressing the ability to request for permissions at run time. Why is this happening?
Luckily, the layer support team was able to help me with this. It solved my problem in the demo app (which targeted SDK 23) and my real app (which targeted SDK 22, to avoid requesting permissions at runtime). After I put tools:node="replace" into my uses-permission line for GET_ACCOUNTS, the pop up dialog was able to appear and grant the permission in the demo app, and the permission was no longer missing in the real app which targeted SDK 22.
Here is the detailed explanation from the Layer support team:
The layer SDK requests the GET_ACCOUNTS permission using a
maxSdkVersion of 18. It would appear that when the manifests get
merged this is overwriting the permission request in your manifest,
thus not requesting that permission for 19+. Could you try appending
tools:node="replace" to the permission in your app's manifest? The
line should read as:
<uses-permission android:name="android.permission.GET_ACCOUNTS" tools:node="replace" />
See here for the maxSdkVersion documentation:
http://developer.android.com/guide/topics/manifest/uses-permission-element.html
See here for the tools:node documentation:
http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger#TOC-tools:node-markers
Peter

Permission Denial: this requires android.permission.INTERACT_ACROSS_USERS_FULL

I am having an issue with sqlite db in Android. But as I made a quick research on the internet, I suspect that the problem is not related to sqlite but system user. My app is not recognized as authorized user to access db functionalities. I tried to apply possible suggested solutions in stack overflow but none of them made a difference. This is the LogCat I am facing every time I attempt to use db functionality.
12-14 02:35:17.721 2953-3355/? E/DatabaseUtils﹕ Writing exception to parcel
java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13082)
at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2038)
at com.android.providers.settings.SettingsProvider.callFromPackage(SettingsProvider.java:577)
at android.content.ContentProvider$Transport.call(ContentProvider.java:279)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:273)
at android.os.Binder.execTransact(Binder.java:388)
at dalvik.system.NativeStart.run(Native Method)
I tried to add permission
android.permission.INTERACT_ACROSS_USERS_FULL
but still no sound. The strange thing is when I try to add INTERNET permission Android Studio 0.3 (ide I use) suggests me possible permissions I can choose. But when it comes to INTERACT_ACROSS_USERS_FULL permission it behaves like it has no idea about this permission. My test device is Samsung S4 running on 4.3.
I assume that I am not the only one who tries to use db on android. So there is a solution.
How can I really add INTERACT_ACROSS_USERS_FULL permission to my application?
According to this answer: android.permission.INTERACT_ACROSS_USERS_FULL is a signature level permission. Your app will not be able to use it until and unless it has the same signature as the system.
Which is not something you can achieve unless you either are the creator or the system build, or collaborating with them such that they are willing to sign your apk with their certificate. In other words, this is off limits for most developers.
I got the error android.permission.INTERACT_ACROSS_USERS_FULL because I had some conflicts in the bin directory of the project. I did some changes to the my app package id and the app-file-1.apk in the bin directory doesn't match with the project.
I did a project > clean and checked that the bin folder was cleared and regenerated, and it works now.
I had the same issue and think that I can help you out. I had registered my app with my production keystore, but was using Eclipse debug to load it into my phone. The Eclipse debug uses debug.keystore which wont match the signature of your production key and throw this error. Use the debug keystore instead for testing or send the apk to yourself and download it onto your phone.
I get this error when I change my minSdkVersion from 8 to 11 in my Manifest. I changed it back to 8 or 9 and no more error.
Try changing your minSdkVersion in your manifest. I was able to repeat the crash and error results with versions 10, 11, and 12 (my app crashes and displays "requires android.permission.INTERACT_ACROSS_USERS_FULL" in the LogCat)
Try to disable auto-fill. It works 100% on Android Oreo. Check this link
Simply add this code to your app :
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
window.decorView.importantForAutofill =
View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS;
}

Categories

Resources