Asking the User for Permission
You wouldn’t let your next-door neighbor store holiday decorations in your shed without permission, would you? Probably not. Android is no different. Performing some actions on a user’s Android device requires permission, as explained in the following sections.
Seeing how permissions affect the user experience
When a user installs an application from the Google Play Store, the application’s manifest file is inspected for required permissions. Anytime your application needs access to sensitive components (such as external storage, the Internet, or device information), the user is notified and decides whether to continue the installation.
If your application doesn’t need a permission, yank it. The fewer number of permissions your application requests, the more likely the user is to install it.
Setting requested permissions in the AndroidManifest.xml file
When you need to request permissions, add them to the AndroidManifest.xml file in your project. You need to add the following permissions to the Task Reminder application:
android.permission.RECEIVE_BOOT_COMPLETED: Allows the application to know when the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
Don’t request unnecessary permissions for your app — security-savvy users are likely to reject it. For example, the Silent Mode Toggle application (described in Part II) doesn’t need GPS locations, Internet access, or hardware-related information.