1
1

More than 3 years have passed since last update.

【翻訳】Android Developers ガイド:アプリの権限の概要

Posted at

デベロッパーガイドのアプリの基本を順に読んでいったのですが、最後のアプリの権限の概要が英語だったので読みながら翻訳しました。

このQiitaでは現公式ドキュメンツに即し基本的に「権限」としてますが、漢字が並んだりして気になった際には適宜「パーミッション」表記にしましたが、同じものと思ってください。
(化石がまだナマモノだった時代の日本語のブログとかだとpermissionは「権限」より「パーミッション」と書いている人が多かったような記憶が朧げにあります。)

アプリの権限(パーミッション)の概容

App permissions overview

Android builds upon system security features by allowing users to grant or deny different app permissions. These permissions protect access to the following:

  • Restricted data, such as system state and a user's contact information.
  • Restricted actions, such as connecting to a paired device and recording audio.

This guide provides an overview of app permissions for developers who are getting started with Android. For more information about how to declare and request permissions, view the in-depth permissions guide. For a complete list of Android app permissions, view the permissions API reference page.

Androidは異なるアプリの権限をユーザーに許可・禁止の設定をさせることで、システムのセキュリティ機能上に構築します。これらの権限は次のようなアクセスを保護します:

  • 制限付きデータ(システム状態やユーザーの連絡先情報といったもの)
  • 制限付きアクション(ペアリングしたデバイスへの接続や、録音など)

このガイドはAndroidを始めたばかりの開発者に、アプリの権限についての概要を説明するものです。権限の宣言やリクエストの仕方など、より詳細な情報が必要な場合は権限の概要を参照してください。Androidアプリの全パーミッションのリストはAPIリファレンスの権限ページを参照してください。

インストール時と実行時の権限

Install-time and runtime permissions

The system grants some permissions to your app automatically when the user installs your app. These permissions are known as normal permissions or install-time permissions.

The system requires your app to request other permissions at runtime. These permissions are known as dangerous permissions or runtime permissions. Many runtime permissions grant your app access to a special type of restricted data, known as private user data. Examples of private user data include location and contact information.

Users are shown different UIs for install-time permissions and runtime permissions:

  • An app store presents an install-time permission notice to the user when they view an app's details page.
  • The system presents a runtime permission prompt to the user when an app requests a runtime permission. Users usually grant or deny access to your app's runtime permissions while they are interacting with your app.

ユーザーがアプリをインストールする際に、OSはいくつかの権限を自動的にアプリに付与します。これらの権限は標準の権限またはインストール時権限と呼ばれるものです。

実行時にはアプリは他の権限を要求する必要があります。これらの権限は危険な権限または実行時権限と呼ばれるものです。多くの実行時権限は、プライベートユーザーデータと呼ばれる特別な種類の制限付きデータへのアクセスをアプリに許可します。プライベートユーザーデータの例には位置情報や連絡先が含まれます。

インストール時権限と実行時権限は異なるUIでユーザーに表示されます。

  • アプリストアはユーザーがアプリの詳細ページを表示した際にインストール時権限を表示します。

  • OSはアプリが実行時権限を要求した際に、実行時権限のプロンプトを表示します。ユーザーは基本的にアプリと相互作用しながら、実行時権限を許可または拒否します。

[訳注:ここでFigure 1(図1)としてインストール時権限と実行時権限のそれぞれの表示例が示されています。左がインストール時権限、右が実行時権限です。実際の画像は公式ページでご確認ください]

Androidのプライバシーゴールのサポート

Support Android's privacy goals

App permissions help Android support the following goals related to user privacy:

Control

The user has control over the data that they share with apps. To support this goal in your app, allow users to continue interacting with your app, even when they deny a permission that your app requests at runtime. Your app should gracefully degrade to provide as much functionality as possible without having access to the information that's associated with the denied permission.

Transparency

The user understands what data an app uses, and why the app accesses this data. Because the system shows a dialog when your app requests a runtime permission, users are aware that your app is requesting access to their data. Your app's UI should it make it clear to users why your app needs access to the information that's associated with the requested permission.

Data minimization

An app accesses and uses only the data that's required for a specific task or action that the user invokes. When users grant a permission to your app, access the minimal amount of data that's required to provide functionality that benefits the user. For example, if you need to access location information, request the ACCESS_COARSE_LOCATION permission instead of the ACCESS_FINE_LOCATION permission if possible.

アプリの権限管理により、Androidがユーザーのプライバシーに関して次のゴールを達成するようサポートします:

コントロール

ユーザーはアプリに共有するデータを制御できます。あなたのアプリでこれを達成するため、ユーザーがアプリの実行時権限要求を拒否した場合でもアプリを継続できるようにしてください。拒否された権限に関連する情報を取得できない場合も、アプリは可能な限り多くの機能を提供するようにデグレードしなければなりません。

透明性

ユーザーはアプリが何のデータを利用していて、何のためにこのデータにアクセスするのかを知ることができます。アプリが実行時権限を要求した際にOSがダイアログを表示するので、ユーザーはアプリが彼らのデータへのアクセス要求していることに気が付きます。アプリのUIは、なぜアプリがこの要求された権限に関連する情報にアクセスする必要があるのかを、ユーザーに明確に伝える必要があります。

データ最小化

アプリはユーザーが呼び出したアクションや特定のタスクに必要なデータのみアクセスします。ユーザーがアプリに権限を許可したら、ユーザーのために提供する機能に必要な最小限のデータにアクセスします。例えば、位置情報へのアクセスが必要な場合は、可能であればACCESS_FINE_LOCATION(訳注:詳細な位置情報)ではなくACCESS_COARSE_LOCATION(訳注:ざっくりした位置情報)を要求します。

ベストプラクティス

Best proctices

To use permissions effectively in your app, follow these best practices:

  • Request a minimal number of permissions in your app. When the user requests a particular action in your app, your app should request only the permissions that it needs to complete that action.

  • Associate runtime permissions with specific tasks and actions in your app. Request permissions as late into the flow of your app's use cases as possible.
    For example, if your app allows users to send audio messages to others, wait until the user has navigated to the messaging screen and has pressed the Send audio message button. After the user presses the button, your app can then request access to the microphone.

権限をアプリ内で効果的に使用するため、次の点に考慮してください:

  • アプリ内では必要最小限の権限だけ要求してください。 ユーザーがある特定の動作を行った場合に、アプリはその動作を完了するのに必要な権限だけをリクエストしなければなりません。

  • アプリ内では実行時権限を特定のタスクやアクションと関連付けてください。なるべくアプリのユースケース上で必要になるまでは権限を要求しないようにします。
    例として、ユーザーが他の人に音声メッセージを送信できるアプリの場合、ユーザーがメッセージ送信画面に導かれたのち音声メッセージを送信ボタンを押すまでは待たなければなりません。ボタン押下後に、アプリはマイクへのアクセスを要求することができます。

権限利用のためのワークフロー

Workflow for using permission

To use permissions in your app, follow this process:

  1. In your app's manifest file, declare the permissions that your app might need to request. By declaring install-time permissions, your app can access the restricted data and perform the restricted actions associated with these install-time permissions after the user installs your app. If your app declares any runtime permissions, continue to the next step.

  2. Design your app's UX so that specific actions in your app are associated with specific runtime permissions. Users should know which actions might require them to grant permission for your app to access private user data.

  3. Wait for the user to invoke the task or action in your app that requires access to specific private user data. At that time, your app can request the runtime permission that's required for accessing that data.

  4. Check whether the user has already granted the runtime permission that your app requires. If so, your app can access the private user data. If not, continue to the next step.

  5. Check whether your app should show a rationale to the user, explaining why your app needs the user to grant a particular runtime permission. If the system determines that your app shouldn't show a rationale, continue to the next step directly, without showing a UI element.
    If the system determines that your app should show a rationale, however, present the rationale to the user in a UI element. This rationale should clearly explain what data your app is trying to access, and what benefits the app can provide to the user if they grant the runtime permission. After the user acknowledges the rationale, continue to the next step.

  6. Request the runtime permission that your app requires in order to access the private user data. The system displays a runtime permission prompt, such as the one shown in Figure 1.

  7. Check the user's response, whether they chose to grant or deny the runtime permission.

  8. If the user granted the permission to your app, you can access the private user data. If the user denied the permission instead, gracefully degrade your app experience so that it provides functionality to the user, even without the information that's protected by that permission.

アプリで権限を使用するためには、以下のプロセスに従ってください:

  1. アプリのマニフェストファイルに、アプリが要求する可能性のある権限を宣言します 。インストール時権限を宣言しておけば、ユーザーがアプリをインストールした後に、アプリから制限付きデータにアクセスしたり、これらのインストール時権限に関連する制限付きアクションを行うことができます。何らかの実行時権限を宣言する場合、次のステップに進んでください。

  2. アプリのUXは、アプリ内の特定のアクションが特定の実行時権限に紐づくように設計してください。どのアクションがプライベートユーザーデータへのアクセス権限を許可するよう要求しているのか知るべきです。

  3. ユーザーがアプリ内でプライベートユーザーデータへのアクセスを必要とするタスクまたはアクションを呼び出すまで待ってください

  4. アプリが必要とする実行時権限をユーザーがすでに許可していないかを確認してください 。もしそうであれば、アプリからプライベートユーザーデータにアクセスすることができます。そうでない場合は次のステップに進みます。

  5. 何故アプリが特定の実行時権限の許可を必要としているかを説明する理論的根拠をアプリからユーザーに示しているかチェックしてください 。もしあなたのアプリが理論的根拠を示していないとOSが判定する場合、UI要素は特に表示せずに次のステップに直接進んでください。
    ただし、理論的根拠を示しているとOSが判定する場合は、UI要素をもってユーザーにその理論的根拠を示してください。この理論的根拠はアプリがどのデータにアクセスしようとしているのか、またユーザーがその実行時権限を許可した場合にどのような利益があるのかを明確に説明しなければなりません。ユーザーが理論的根拠を承認した後、次のステップに進みます。

  6. アプリがプライベートユーザーデータにアクセスするために必要な実行時権限をリクエストしてください。OSは図1で示したような実行時権限プロンプトを表示します。

  7. ユーザーが実行時権限を許可したか否かにかかわらず、ユーザーの返答を確認してください。

  8. ユーザーがアプリに権限を許可したらプライベートユーザーデータにアクセスすることができます。逆にユーザーが権限を拒否した場合は、その権限により保護されている情報が無くても可能な限り多くの機能を提供するよう、 潔くアプリのUXをデグレードしてください


『権限利用のためのワークフロー』5.のOSが理論的根拠を示しているかOSが判定する記述のあたりがいまいちイメージできないのですが、この後色々と読んでいけばわかるようになるかなーと思ってます。その時は必要であれば注記します。

上から順に読んでいくと次は『デバイス』の章が続きます。この中では『デバイスの互換性』は必須と思いますが、他はスマホ・タブレット以外のデバイス対応が必要になった時に参照すれば良いでしょう。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1