We are making the following changes to foreground service types with Android 15.
جارٍ معالجة الوسائط
- Foreground service type to declare in manifest under
android:foregroundServiceTypemediaProcessing- 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
mediaProcessingforeground services.)Your app should manually stop the media processing service in the following scenario:
- When the transcoding operation finishes or reaches a failure state, have the
service call
Service.stopForeground()andService.stopSelf()to stop the service completely.
- When the transcoding operation finishes or reaches a failure state, have the
service call
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 callService.stopSelf(). If the service does not callService.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.
الكاميرا
Apps that target Android 15 or higher are not allowed to launch a
camera foreground service from a BOOT_COMPLETED broadcast receiver.
For more information, see
Restrictions on BOOT_COMPLETED broadcast receivers launching foreground
services.
مزامنة البيانات
لا يُسمح للتطبيقات التي تستهدف الإصدار Android 15 أو الإصدارات الأحدث بتشغيل
خدمة مزامنة بيانات تعمل في المقدّمة من مستقبل بث BOOT_COMPLETED.
لمزيد من المعلومات، يُرجى الاطّلاع على
القيود المفروضة على BOOT_COMPLETED أجهزة استقبال البث التي تبدأ خدمات
في المقدّمة.
تشغيل الوسائط
لا يُسمح للتطبيقات التي تستهدف الإصدار Android 15 أو الإصدارات الأحدث بتشغيل
خدمة تشغيل وسائط تعمل في المقدّمة من خلال مستقبل بث BOOT_COMPLETED.
لمزيد من المعلومات، يُرجى الاطّلاع على
القيود المفروضة على BOOT_COMPLETED أجهزة استقبال البث التي تبدأ خدمات
في المقدّمة.
عرض الوسائط
Apps that target Android 15 or higher are not allowed to launch a
media projection foreground service from a BOOT_COMPLETED broadcast receiver.
For more information, see
Restrictions on BOOT_COMPLETED broadcast receivers launching foreground
services.
الميكروفون
لا يُسمح للتطبيقات التي تستهدف الإصدار 14 من نظام التشغيل Android (المستوى 34 لواجهة برمجة التطبيقات) أو الإصدارات الأحدث بتشغيل
خدمة تعمل في المقدّمة للميكروفون من مستقبل بث BOOT_COMPLETED.
لمزيد من المعلومات، يُرجى الاطّلاع على
القيود المفروضة على BOOT_COMPLETED خدمات البث التي تبدأ خدمات
في المقدّمة.
المكالمات الهاتفية
لا يُسمح للتطبيقات التي تستهدف الإصدار 15 من نظام التشغيل Android أو الإصدارات الأحدث بتشغيل
خدمة تعمل في المقدّمة للمكالمات الهاتفية من مستقبل بث BOOT_COMPLETED.
لمزيد من المعلومات، يُرجى الاطّلاع على
القيود المفروضة على BOOT_COMPLETED أجهزة استقبال البث التي تبدأ خدمات
في المقدّمة.