O'Reilly logo

Android Application Development For Dummies, 2nd Edition by Donn Felker, Michael Burton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

remember.eps 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.

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required