-1

Here is the issue that showed in a logcat.

Unable to start service .DownloadService@489b627 with Intent { cmp=package/.DownloadService (has extras) }: java.lang.NullPointerException

I'm getting this issue after with Android 26 or higher.

I'm using startForegroundService and added permission in the manifest

if (Build.VERSION.SDK_INT >= 26) {
                        home.this.mContext.startForegroundService(intent);
                    } else {
                        home.this.mContext.startService(intent);
                    }
Nithis Kumar
  • 278
  • 2
  • 5
  • 21

1 Answers1

0

Need to know more about your current implementation, it is too hard to understand what's wrong with yours.

I can't suggest much, maybe you need to check if your intent null or not (not really sure)

if (intent != null) {
    // do your stuff
}

Or I would suggest you take a look at your code again and see if this linked answer works for you. https://stackoverflow.com/a/46391826/11105217 (tip: foreground service along with the persistent notification)

Rych Emrycho
  • 85
  • 10