Software⏱️ 2 min read📅 2026-05-30

How to Fix: Android 8.0: java.lang.IllegalStateException: Not allowed to start service Intent

Android 8.0 background execution limit issue

Quick Answer: To resolve the issue, use a foreground service or implement a WorkManager to schedule tasks.

On Android 8.0, the background execution limit is enforced, which restricts services from running in the background when the app is not actively being used. This restriction applies to all apps targeting API level 26 and above.

⚠️ Common Causes

  • Targeting API level 26 or higher without properly handling the background execution limit.

🚀 How to Resolve This Issue

Method 1: Service Foreground

  1. Step 1: Declare your service as a foreground service by calling the startForeground method with a Notification.

Method 2: Use JobScheduler

  1. Step 1: Create a JobRequest that specifies the service to run in the background.

✨ Wrapping Up

By implementing one of these methods, you can resolve the issue and ensure your service runs in the background on Android 8.0.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions