Skip to content

Instantly share code, notes, and snippets.

Created April 2, 2019 16:36
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Fix JobIntentService Crash for 8.x Phones
1. Create a new package in your app with name This is a workaround to override package-private methods.
2. Create or Edit your Own ServiceClass to Override dequeueWork() method and surround super.dequeueWork() call with try/catch block like the coming snippet.
Any code that uses JobIntent Service override with this class
(Important Note: This fix should be tracked from time to time as any change in the support libraries might break it.)
public abstract class MyServiceImpl extends JobIntentService {
// This method is the main reason for the bug and crash
// the dequeueWork method is called only when the worker service is done
// so no need to call for a restart to the service.
GenericWorkItem dequeueWork() {
try {
return super.dequeueWork();
} catch (SecurityException exception) {
// the exception will be ignored here.
return null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment