การเปลี่ยนแปลงประเภทบริการที่ทำงานอยู่เบื้องหน้าสำหรับ Android 15

เราจะทำการเปลี่ยนแปลงต่อไปนี้กับประเภทบริการที่ทำงานอยู่เบื้องหน้าใน Android 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 ขึ้นไปไม่ได้รับอนุญาตให้เปิดบริการที่ทำงานอยู่เบื้องหน้าของกล้องจาก Broadcast Receiver BOOT_COMPLETED ดูข้อมูลเพิ่มเติมได้ที่ข้อจํากัดของ BOOT_COMPLETED ตัวรับการออกอากาศที่เปิดบริการอยู่เบื้องหน้า

การซิงค์ข้อมูล

แอปที่กำหนดเป้าหมายเป็น Android 15 ขึ้นไปไม่ได้รับอนุญาตให้เปิดบริการที่ทำงานอยู่เบื้องหน้าสำหรับการซิงค์ข้อมูลจาก Broadcast Receiver BOOT_COMPLETED ดูข้อมูลเพิ่มเติมได้ที่ข้อจํากัดของ BOOT_COMPLETED ตัวรับการออกอากาศที่เปิดบริการอยู่เบื้องหน้า

การเล่นสื่อ

แอปที่กำหนดเป้าหมายเป็น Android 15 ขึ้นไปไม่ได้รับอนุญาตให้เปิดบริการที่ทำงานอยู่เบื้องหน้าสำหรับการเล่นสื่อจาก Broadcast Receiver BOOT_COMPLETED ดูข้อมูลเพิ่มเติมได้ที่ข้อจํากัดของ BOOT_COMPLETED ตัวรับการออกอากาศที่เปิดบริการอยู่เบื้องหน้า

การฉายภาพสื่อ

แอปที่กำหนดเป้าหมายเป็น Android 15 ขึ้นไปไม่ได้รับอนุญาตให้เปิดบริการที่ทำงานอยู่เบื้องหน้าของโปรเจ็กชันสื่อจาก Broadcast Receiver BOOT_COMPLETED ดูข้อมูลเพิ่มเติมได้ที่ข้อจํากัดของ BOOT_COMPLETED ตัวรับการออกอากาศที่เปิดบริการอยู่เบื้องหน้า

ไมโครโฟน

แอปที่กำหนดเป้าหมายเป็น Android 14 (API ระดับ 34) ขึ้นไปไม่ได้รับอนุญาตให้เปิดบริการที่ทำงานอยู่เบื้องหน้าของไมโครโฟนจาก Broadcast Receiver BOOT_COMPLETED ดูข้อมูลเพิ่มเติมได้ที่ข้อจํากัดของ BOOT_COMPLETED ตัวรับการออกอากาศที่เปิดบริการอยู่เบื้องหน้า

การโทร

แอปที่กำหนดเป้าหมายเป็น Android 15 ขึ้นไปไม่ได้รับอนุญาตให้เปิดบริการที่ทำงานอยู่เบื้องหน้าสำหรับการโทรจาก Broadcast Receiver BOOT_COMPLETED ดูข้อมูลเพิ่มเติมได้ที่ข้อจํากัดของ BOOT_COMPLETED ตัวรับการออกอากาศที่เปิดบริการอยู่เบื้องหน้า