I installed the new android ADT and now I see warnings about exported services defined in the AndroidManifest that do not require a permission.
The problem is that the services are related with the sync adapter. In the SampleSyncAdaapter there are no required permissions either but I do not see that warning.
Which permission should I define for the sync adapter?
I have the same problem for the service that handles CLEAR_MISSED_CALLS.
You are getting that warning because you are exporting the service with no permission restrictions. In your <service> declaration, make the permission android:permission="your.app.name".
Example:
<service android:name=".ClassName" android:permission="your.app.name"></service>
For a more detailed explanation, have a look here.
Related
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.
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.
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.
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
I have seen a few similar posts to this, but i already have had the ContentProvider registered in my AndroidManifest.
I have a ContentProvider called MyContentProvider.
And MyContentProvider is located in a library project called MyProject. With package location personal.mobile.abc.angry.tiger.MyContentProvider.
My AndroidManifest for this project looks like this (left out info that is not related):
<application
android:label=...
android:icon=...
android:theme=...>
<provider
android:name="personal.mobile.abc.angry.tiger.MyContentProvider"
android:authorities="personal.mobile.abc.angry.tiger">
</provider>
</application>
Lint keeps saying this:
The <provider> personal.mobile.abc.angry.tiger.MyContentProvider is not registered in the manifest.
And Logcat says this when attempting to run the application that includes the library that contains the ContentProvider:
Failed to find provider info for personal.mobile.abc.angry.tiger
What am i doing wrong? What is the issue?
If you need any further information, please let me know.
Thanks!
Your <provider> element needs to be in the application, as it is the one with the ContentProvider. The fact that the Java class implementing that ContentProvider happens to be in an Android library project does not change the fact that the hosting app is the one responsible for that provider.
Eventually -- perhaps as soon as ADT 21 -- your <provider> element in the library project can be automatically added to your application project. Right now, AFAIK, that process is manual.