تغییرات در انواع خدمات پیش زمینه برای Android 15

ما در حال ایجاد تغییرات زیر در انواع سرویس های پیش زمینه با اندروید 15 هستیم.

پردازش رسانه

Foreground service type to declare in manifest under
android:foregroundServiceType
mediaProcessing
Permission to declare in your manifest
FOREGROUND_SERVICE_MEDIA_PROCESSING
Constant to pass to startForeground()
FOREGROUND_SERVICE_TYPE_MEDIA_PROCESSING
Runtime prerequisites
None
Description

Service for performing time-consuming operations on media assets, like converting media to different formats. The system allows this service a limited time to run; under normal circumstances, this time limit would be 6 hours out of every 24. (This limit is shared by all of an app's mediaProcessing foreground services.)

Your app should manually stop the media processing service in the following scenario:

If the timeout period is reached, the system calls the service's Service.onTimeout(int, int) method. At this time, the service has a few seconds to call Service.stopSelf(). If the service does not call Service.stopSelf(), an ANR will occur with this error message: "A foreground service of <fgs_type> did not stop within its timeout: <component_name>".

Note: Service.onTimeout(int, int) is not available on Android 14 or lower. On devices running those versions, if a media processing service reaches the timeout period, the system immediately caches the app. For this reason, your app shouldn't wait to get a timeout notification. Instead, it should terminate the foreground service or change it to a background service as soon as appropriate.

دوربین

برنامه‌هایی که Android 15 یا بالاتر را هدف قرار می‌دهند، مجاز به راه‌اندازی سرویس پیش‌زمینه دوربین از گیرنده پخش BOOT_COMPLETED نیستند. برای اطلاعات بیشتر، به محدودیت‌های گیرنده‌های پخش BOOT_COMPLETED در راه‌اندازی خدمات پیش‌زمینه مراجعه کنید.

همگام سازی داده ها

برنامه‌هایی که Android 15 یا بالاتر را هدف قرار می‌دهند، مجاز به راه‌اندازی سرویس پیش‌زمینه همگام‌سازی داده‌ها از گیرنده پخش BOOT_COMPLETED نیستند. برای اطلاعات بیشتر، به محدودیت‌های گیرنده‌های پخش BOOT_COMPLETED در راه‌اندازی خدمات پیش‌زمینه مراجعه کنید.

پخش رسانه

以 Android 15 或更高版本为目标平台的应用不得通过 BOOT_COMPLETED 广播接收器启动媒体播放前台服务。如需了解详情,请参阅对启动前台服务的 BOOT_COMPLETED 广播接收器的限制

فرافکنی رسانه ای

برنامه‌هایی که Android 15 یا بالاتر را هدف قرار می‌دهند، مجاز به راه‌اندازی سرویس پیش‌زمینه نمایش رسانه از گیرنده پخش BOOT_COMPLETED نیستند. برای اطلاعات بیشتر، به محدودیت‌های گیرنده‌های پخش BOOT_COMPLETED در راه‌اندازی خدمات پیش‌زمینه مراجعه کنید.

میکروفون

以 Android 14(API 级别 34)或更高版本为目标平台的应用不得通过 BOOT_COMPLETED 广播接收器启动麦克风前台服务。如需了解详情,请参阅对启动前台服务的 BOOT_COMPLETED 广播接收器的限制

تماس تلفنی

برنامه‌هایی که Android 15 یا بالاتر را هدف قرار می‌دهند، مجاز به راه‌اندازی سرویس پیش‌زمینه تماس تلفنی از گیرنده پخش BOOT_COMPLETED نیستند. برای اطلاعات بیشتر، به محدودیت‌های گیرنده‌های پخش BOOT_COMPLETED در راه‌اندازی خدمات پیش‌زمینه مراجعه کنید.