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.
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
- 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.
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
- 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
-
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.
-
Declare the service with its
android:foregroundServiceTypevalue, plusFOREGROUND_SERVICEand the matching type-specific manifest permission.The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Request and confirm any required runtime permissions or other prerequisites before promotion.
Rank #3
SaleSamsung 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.
-
Start the service with
context.startForegroundService(). -
Promote it with
ServiceCompat.startForeground(), supplying the applicable type flags. The runtime type must be consistent with the type declared in the manifest. -
Check target-SDK-specific background-start rules and any time limits or boot restrictions that apply to the selected type.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchSpecial 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
- 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.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.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Troubleshoot common startup failures
-
SecurityException: Verify the base permission, the matching type-specific manifest permission, and the service’s declared type. Confirm that required runtime permissions and other prerequisites were satisfied before promotion. Then check whether the start occurred from a prohibited background context or violated a while-in-use restriction. Android’s troubleshooting guide covers common failures.Best Value
Tracfone Moto g Play 2024 Prepaid Phone with a 1-Yr Plan Included- Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Activating is easy, just 3 steps.
- ACTIVATION Promotion: Includes 1500 min, 1500 texts & 1500 MB Data + add more as you need it
- CAMERA SYSTEM: 50MP Quad Pixel camera. Capture sharper, more vibrant photos day or night with 4x the light sensitivity.
- PERFORMANCE: Blazing-fast Qualcomm performance. Get the speed you need for great entertainment with a Snapdragon 680 processor and 4GB of RAM.
- 64GB built-in storage. Get plenty of room for photos, movies, songs, and apps. Made for US
-
MissingForegroundServiceTypeException: Check that the service declaration includes a validandroid:foregroundServiceTypefor the task. -
Argument or type error during
startForeground(): Compare the runtime type flags with the types declared on the service in the manifest. -
Permission appears granted, but promotion still fails: A runtime grant does not by itself satisfy a missing foreground-service manifest permission, a type mismatch, or a background-start restriction. Check all three separately.
Free tools Windows power users keep installed
One-click scans. No signup required.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.Quick Recap
Bestseller No. 1Bestseller No. 2SaleBestseller No. 3Bestseller No. 5
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.




