if All required permissions granted proceed as

If all required permissions granted proceed as

This preview shows page 40 - 46 out of 47 pages.

if (verifyPermissions(grantResults)) { // All required permissions granted, proceed as usual Log.d(DEBUG_TAG, "Contacts permissions were granted."); Toast.makeText(this, "Contacts Permission Granted", Toast.LENGTH_SHORT).show(); } else { Log.d(DEBUG_TAG, "Contacts permissions were denied."); Toast.makeText(this, "Contacts Permission Denied", Toast.LENGTH_SHORT).show(); } } else { super.onRequestPermissionsResult(requestCode, permissions, grantResults); } } Must implement the OnRequestPermissionsResultCallback by overriding the onRequestPermissionsResult() method in your Activity as shown here. This method handles the result input by the user, and if the user accepted, the permission is now available to your application; if the user denied the request, the permission will not be available. Whatever features you develop that require those denied permissions will not be made available until the user chooses to grant the appropriate permission .
Image of page 40

Subscribe to view the full document.

Registering Permissions Your Application Enforces Applications can also define and enforce their own permissions via the <permission> tag. These are used by other applications. Permissions must be described and then applied to specific application components, such as activities using the android:permission attribute.
Image of page 41
Registering Permissions Your Application Enforces (Cont’d) Permissions can be enforced at several points: When starting an Activity or Service When accessing data provided by a content provider At the method call level When sending or receiving broadcasts by an Intent
Image of page 42

Subscribe to view the full document.

Registering Permissions Your Application Enforces (Cont’d) Permissions can have three primary protection levels: normal, dangerous, and signature. Normal is a good default for fine-grained permission enforcement within the application. Dangerous is used for higher-risk activities. Signature permits any application signed with the same certificate to use that component for controlled application interoperability.
Image of page 43
Registering Permissions Your Application Enforces (Cont’d) Permissions can be broken down into categories: Permission groups, which describe or warn why specific activities require permission Permissions might be applied for activities that Expose sensitive user data such as location and personal information android.permission-group.LOCATION and android.permission-group.PERSONAL_INFO Access underlying hardware android.permission-group.HARDWARE_CONTROLS Perform operations that might incur fees to the user android.permission-group.COST_MONEY A complete list of permission groups is available within the Manifest.permission_group class.
Image of page 44

Subscribe to view the full document.

Exploring Other Manifest File Settings Some other features you can configure: Setting application-wide themes using the <application> tag attributes Configuring unit-testing features using the <instrumentation> tag Aliasing activities using the <activity-alias> tag Creating broadcast receivers using the <receiver> tag Creating content providers using the <provider> tag
Image of page 45
Image of page 46
  • Summer '16

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes