Instructions for migrating from CWAC Wakeful to JobIntentService?

I’ve been using the WakefulIntentService, but since Google has informed me that I have to target API level 26 or higher as of 2 weeks ago, I’m trying to figure out how to move to JobIntentService.

The paragraph about it at GitHub wasn’t quite detailed enough. Are there more detailed, step-by-step instructions available somewhere?

Not really, as I’m not sure what would be needed.

Here is a rough-cut conversion of the demo app’s service to a JobIntentService:

public class AppJobService extends JobIntentService {
  static final int JOB_ID = 1000;
  static void enqueueWork(Context context, Intent work) {
    enqueueWork(context, AppJobService.class, JOB_ID, work);

  protected void onHandleWork(Intent i) {
    Log.i("AppService", "I'm awake! I'm awake! (yawn)");

(with bits of that code borrowed from the JobIntentService JavaDocs)

Then, instead of WakefulIntentService.sendWakefulWork(context, AppService.class);, you would use AppJobService.enqueueWork(context, new Intent(context, AppJobService.class));.

If there is something more that you need, let me know!

Thanks! That gave me the boost I needed to figure the rest out. :smile: