Changes to foreground services

The foreground service documentation describes the current behavior of Android foreground services. The documentation gives guidance on best practices for most apps, whether or not they target the most recent version of Android.

This page describes some of the most recent important changes to foreground services, and the implications for apps that aren't targeting the most recent version of the Android platform. In many cases, best practices that were optional for apps targeting lower API levels become mandatory for apps that target higher API levels.

Android 9 (API level 28)

Android 9 introduces the FOREGROUND_SERVICE permission. Apps running on Android 9 that use foreground services must have that permission.

If an app that targets API level 28 or higher attempts to create a foreground service without requesting the FOREGROUND_SERVICE permission, the system throws a SecurityException.

Android 10 (API level 29)

The following requirements apply to apps that target API level 29 or higher:

Android 11 (API level 30)

The following requirements apply to apps that target API level 30 or higher:

Android 12 (API level 31)

The following requirements apply to apps that target API level 31 or higher:

Android 14 (API level 34)

The following requirements apply to apps that target API level 34 or higher:

  • You must declare all foreground services with their service types.
  • Apps must request the appropriate permission type for the kind of work the foreground service will be doing. Each foreground service type has a corresponding permission type. For example, if an app launches a foreground service that uses the camera, you must request both the FOREGROUND_SERVICE and FOREGROUND_SERVICE_CAMERA permissions. If an app targets API level 34 or higher and doesn't request the appropriate specific permission, the system throws a SecurityException.

Android 15 (API level 35)

The following requirements apply to apps that target API level 35 or higher: