Android Custom permission simple and practical manual

Source: Internet
Author: User

Custom permission can improve the security of your app. By setting permission, you can protect your app from unauthorized access to apps. For example, we will register Activity/service/reciever in the Androidmanifest.xml, filter the action we want to receive in Intent-filter, If there is a send source that is not what we know sends us a matching action, it has the potential to affect our app and may even compromise the user.


How to use

    1. Register permission
    2. Adding permissions in the corresponding Activity/service and reciever
    3. Using permission

a simple example

Create two project, one Sendbroadcastrecieverdemon, one Recievedemon

    1. Register a custom permission in the Recievedemon project Androidmanifest.xml
    2. Create a reciever and add permission permissions
    3. Using permission in Sendbroadcastrecieverdemon projects
    4. Send intent to the Recievedemon project in the Sendbroadcastrecieverdemon project
    5. OK, so you can receive the intent message sent by Sendbroadcastrecieverdemon in the Recievedemon project.
It's not easy, haha.



Android Custom permission simple and practical manual

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.