Android 11 のフォアグラウンド サービス
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Android 11 では、フォアグラウンド サービスがデバイスの位置情報、カメラ、マイクにアクセスできるタイミングが変更されています。これにより、機密性の高いユーザーデータを保護できます。
- カメラとマイク(フォアグラウンド サービス タイプ)
- アプリが Android 11 以降をターゲットとしており、フォアグラウンド サービスでカメラまたはマイクにアクセスする場合、フォアグラウンド サービス タイプとして
camera
と microphone
を含める必要があります。
- 使用中のアクセス制限
- アプリがバックグラウンドで実行されているときにフォアグラウンド サービスを開始する場合、フォアグラウンド サービスはマイクやカメラにアクセスできません。また、アプリがバックグラウンドで位置情報にアクセスできない限り、サービスは位置情報にアクセスできません。
詳しくは、アプリでのフォアグラウンド サービスの利用方法をご覧ください。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-08-27 UTC。
[null,null,["最終更新日 2025-08-27 UTC。"],[],[],null,["# Foreground services in Android 11\n\nAndroid 11 changes when foreground services can\naccess the device's location, camera, and microphone. This helps protect\nsensitive user data.\n\nCamera and microphone foreground service types\n: If your app targets Android 11 or higher and accesses the\n camera or microphone in a foreground service, you must include the `camera` and\n `microphone` [foreground service\n types](/guide/components/foreground-services#types).\n\nRestrictions to access while in use\n: If your app [starts a foreground service while running in the\n background](/guide/components/foreground-services#while-in-use-restrictions), the\n foreground service cannot access the microphone or camera. Additionally,\n the service cannot access location unless your app\n has [background location](/training/location/permissions#background) access.\n\nLearn more about how to use [foreground\nservices](/guide/components/foreground-services) in your app."]]