问题
Now this is something very interesting for me, I know mostly about Runtime Permissions and i am well aware of why Runtime Permissions proposed? and How we can use it? but in this question which is about a problem rising due to this run time permission thing, A guy proposed a pretty newer way to solve this problem.
See U.swap's answer on the same question,here is that answer.
This guy Proposed a nice and working solution that user have to approve Permissions only once and for rest of his life he don't have to worry about all Runtime permissions and application will run on marshmallow versions and Pre-marshmallow versions as discussed in comments see all comments as discussed between me and Commonsware.
@NiteshPareek: There is nothing about this answer that prevents the app from running on Android 6.0+ devices -Commonsware
but it means that we can buypass the security proposed by Runtime Permissions? @CommonsWare – Tapan parmar
@Tapanparmar: No, as users can manually revoke permissions in Settings. Having targetSdkVersion 22 or lower means that your app is not going to have any runtime permission code, so the user needs to agree to your requested permissions at install time. This is how Android worked from the beginning. – CommonsWare
ok so app will run on marshmallow without showing permissions? @CommonsWare - Tapan Parmar
@Tapanparmar: The user will be presented with permissions at the time the app is installed. – CommonsWare
ok so we can skip that freaking permissions providing by this but is there any drawbacks by doing it? @CommonsWare
@Tapanparmar: Users may elect not to install your app, if they do not like granting all the permissions up front. Also, other behaviors that you might want based on higher targetSdkVersion values may be lost. If you have additional concerns, please ask a separate Stack Overflow question. – CommonsWare
So i want to know are there any actual drawbacks of doing this? And what will happen to security which was main purpose of RunTimePermissions. And is it really preferable to do this?
See the comments here on the answer or see the image below
回答1:
are there any actual drawbacks of doing this?
Users may elect not to install your app, if they do not like granting all the permissions up front. Also, other behaviors that you might want based on higher targetSdkVersion
values may be lost.
And what will happen to security which was main purpose of RunTimePermissions
Nothing. You still need all the <uses-permission>
elements, and the user still has to agree to give you the permissions. However, that agreement occurs primarily at install time, not when the app is run. Bear in mind that users of Android 6.0+ devices still can revoke the dangerous
-level permissions via the Settings app.
And is it really preferable to do this?
IMHO, no. Eventually, something is going to force your hand and require you to upgrade your targetSdkVersion
. And, as I have noted, users may prefer to not install your app, going with some other app, one that does not ask for a lot of permissions at install time. Using a targetSdkVersion
below 23 is a fine answer for apps that are no longer being maintained or for inexperienced developers.
来源:https://stackoverflow.com/questions/38411785/can-i-skip-asking-runtime-permissions-on-marshmallow