October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Mountain View desk4 min

How to Request the Right Foreground Service Permissions in Android

Learn how to choose an Android foreground service type, declare matching manifest permissions, satisfy runtime prerequisites, and diagnose startup failures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose an Android foreground service type that accurately describes the work, declare that type and its matching manifest permission, and satisfy any separate runtime prerequisites before promoting the service. The rules depend in important ways on your app’s target SDK: apps targeting API 34 or later must declare a valid type and its matching permission, while newer target levels add further limits and restrictions.

What permissions does a foreground service need?

For a foreground service, declare the base android.permission.FOREGROUND_SERVICE permission and the type-specific FOREGROUND_SERVICE_<TYPE> permission that matches the service’s work. Also declare the type on the service itself with android:foregroundServiceType. For apps targeting Android 14 (API 34) or later, omitting the type or matching permission can cause service startup to fail.

As an Amazon Associate I earn from qualifying purchases.

These foreground-service permissions are manifest permissions, documented as normal permissions. They do not grant other permissions the work may need. For example, a camera service also needs the user to grant the CAMERA runtime permission. See Android’s manifest declaration and permission guidance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a type that matches the user-visible task

Do not select a type simply because it seems permissive or convenient. Pick the type that describes the ongoing work the user can understand, and declare only the types the service actually needs. Android 14 documents types such as camera, connectedDevice, dataSync, health, location, mediaPlayback, mediaProjection, microphone, phoneCall, remoteMessaging, shortService, specialUse, and systemExempted. Android 15 adds mediaProcessing. Consult the current foreground service type guide for each type’s purpose and conditions.

#1 Best Overall
Samsung Galaxy A17 5G Smart Phone 128GB US 1 Yr Manufacturer Warranty Black | Large AMOLED, High-Res Camera, Durable Design, Super Fast Charging, Expandable Storage, Circle to Search, 2025
  • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
  • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
  • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
  • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
  • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.

A service can have multiple types when its work genuinely fits more than one. Separate types in the manifest with |, and ensure the runtime type flags used when promoting the service are consistent with the manifest.

Declare the service and permissions in the manifest

For example, a camera foreground service needs the base permission, the camera-specific foreground-service permission, and a service declaration whose type is camera. The manifest structure is:

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
<uses-permission android:name="android.permission.CAMERA" />

<application ...>
    <service
        android:name=".CameraService"
        android:foregroundServiceType="camera"
        android:exported="false" />
</application>

The first two declarations cover foreground-service authorization for the type; CAMERA is a separate runtime permission that must be granted before the service uses the camera. Replace the camera-specific permission, runtime permission, and type with the correct ones for your actual task. Android’s declaration guide describes the required manifest setup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check runtime prerequisites before promotion

Type-specific manifest permission is not a substitute for the permission or condition that grants access to the underlying capability. Before promoting the service, check the applicable runtime grant and any other type-specific prerequisite. Camera work, for example, requires the camera runtime permission; location work requires coarse or fine location access. Some types have additional conditions, so check the type-specific requirements rather than assuming the manifest entries alone are sufficient.

Rank #2
Tracfone Motorola Moto G 2025, 64GB, Saphire Blue (Locked to
  • Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Tracfone plan required, activating is easy, just 3 steps.
  • DISPLAY: Immersive viewing on a 6.7-inch super-bright 120Hz display with powerful stereo speakers and Bass Boost for cinematic entertainment.
  • CAMERA SYSTEM: Advanced 50MP Quad Pixel camera captures sharp, detailed photos and videos in any lighting condition
  • PERFORMANCE: Lightning-fast 5G connectivity paired with a powerful processor and RAM Boost for smooth multitasking.
  • BATTERY LIFE: Long-lasting 5000mAh battery with TurboPower charging technology delivers hours of power in minutes.

Account for launch context as well as grants. A permission granted while the app is visible does not automatically remove background-start or while-in-use restrictions. Android 12 (API 31) introduced limits on starting foreground services from the background for apps targeting API 31 or later, with defined exceptions. Review the target-SDK behavior changes and the requirements for launching a foreground service.

Start and promote the service in the right order

  1. Confirm that the task is appropriate for a foreground service and choose its type. If Android provides a more suitable purpose-built API, consider that instead.

  2. Declare the service with its android:foregroundServiceType value, plus FOREGROUND_SERVICE and the matching type-specific manifest permission.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  3. Request and confirm any required runtime permissions or other prerequisites before promotion.

    Rank #3
    Sale
    Samsung Galaxy A17 5G Smart Phone 128GB, US 1 Yr Manufacturer Warranty Blue | Large AMOLED, High-Res Camera, Durable Design, Super Fast Charging, Expandable Storage, Circle to Search, 2025
    • YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
    • LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
    • MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
    • NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
    • BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.
  4. Start the service with context.startForegroundService().

  5. Promote it with ServiceCompat.startForeground(), supplying the applicable type flags. The runtime type must be consistent with the type declared in the manifest.

  6. Check target-SDK-specific background-start rules and any time limits or boot restrictions that apply to the selected type.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Android’s launch guidance for the promotion requirements and timing. Starting from a disallowed background context or calling promotion before prerequisites are satisfied can fail even when the manifest entries are present.

Rank #4
Sale
Samsung Galaxy S26 Ultra, Unlocked Android Smartphone, 512GB, Black
  • PRIVACY DISPLAY: Automatically hide your screen from those beside you. The built-in privacy display can be preset¹ to turn on when receiving notifications, typing passwords, or using specific apps
  • TYPE IT IN. TRANSFORM IT FAST: Enhance any shot in seconds on your smartphone by using Photo Assist² with Galaxy AI.³ Add objects, restore details, or apply new styles by simply typing or tapping
  • NIGHTS, CAPTURED CLEARLY: From gigs to city lights, record and capture moments after dark with clarity using Nightography so your photos and videos stay crisp and clear on your Samsung Galaxy
  • MAKE IT. EDIT IT. SHARE IT: Turn everyday moments into something personal with creative tools built right into your mobile phone, whether it’s a special contact photo, custom wallpaper, an invitation or more⁴
  • HELP THAT KEEPS UP: Stay in the moment while Now Nudge with Galaxy AI helps you respond faster and stay organized with smart suggestions⁵ that appear exactly when you need them on your phone

Check whether a foreground service is the right tool

A foreground service is for qualifying work that is apparent to the user, not a default mechanism for all lengthy or deferred tasks. If no foreground-service type accurately fits the work, Android’s API 34 behavior guidance recommends considering WorkManager or user-initiated data transfer jobs. Choose a mechanism that matches the task rather than forcing it into an inaccurate service type. See Android 14’s type requirements and alternatives.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Account for target API changes

Foreground-service requirements are tied to the app’s target SDK, not just the Android version installed on a device. Android 12 introduced background-start limits for apps targeting API 31 or later, subject to exceptions. For apps targeting API 34 or later, Android requires a type declaration and its matching foreground-service permission. Android 15 (API 35) adds further type-specific behavior, including limits for dataSync and mediaProcessing and changes to some BOOT_COMPLETED launches. Check the official foreground-service changes by target level when raising your target SDK.

Android 15 media processing limit

Under normal circumstances, a mediaProcessing foreground service is limited to six hours in every 24-hour period, shared across the app’s services of that type. Stop the service when processing finishes or fails. This is a platform limit described in the Android 15 service-type changes, not a general allowance for every foreground service.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot common startup failures

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.