Enforcing Permissions Elsewhere

 

In your code, you have two additional ways to enforce permissions.

Your services can check permissions on a per‑call basis via . This returns or , depending on whether the caller has the permission you specified. For example, if your service implements separate read and write methods, you could get the effect of and in code by checking those methods for the permissions you need from Java.

Also, you can include a permission when you call . This means that eligible receivers must hold that permission; those without the permission are ineligible to receive it. For example, the Android subsystem presumably includes the permission when it broadcasts that an SMS message has arrived – this will restrict the receivers of that intent to be only those authorized to receive SMS messages.

 

 

May I See Your Documents?

 

There is no automatic discovery of permissions at compile time; all permission failures occur at runtime. Hence, it is important that you document the permissions required for your public APIs, including content providers, services, and activities intended for launching from other activities. Otherwise, the programmers attempting to interface with your application will have to find out the permission rules by trial and error.

Furthermore, you should expect that users of your application will be prompted to confirm any permissions your application says it needs. Hence, you need to document for your users what they should expect, lest they get confused by the question posed by the phone and elect to not install or use your application.

 

 








Дата добавления: 2015-05-16; просмотров: 757;


Поиск по сайту:

При помощи поиска вы сможете найти нужную вам информацию.

Поделитесь с друзьями:

Если вам перенёс пользу информационный материал, или помог в учебе – поделитесь этим сайтом с друзьями и знакомыми.
helpiks.org - Хелпикс.Орг - 2014-2024 год. Материал сайта представляется для ознакомительного и учебного использования. | Поддержка
Генерация страницы за: 0.005 сек.