Home » Android » java – How To fix context.getSystemService(class) for api 21?

java – How To fix context.getSystemService(class) for api 21?

Posted by: admin June 15, 2020 Leave a comment

Questions:

I was following the video for JobScheduler:

https://www.youtube.com/watch?v=XFN3MrnNhZA

But lint was giving me that context.getSystemService(class) is api 23. So am I missing something or did android change something with there api?

Note: Mostly wondering if JobScheduler was introduced in api 21 how would it work without getSystemService(Class)

Thanks.

How to&Answers:

Thanks to Reghunandan I found a better solution for my problem by using:

github.com/firebase/firebase-jobdispatcher-android

But if any body got same problem here is the mistake:

getSystemService(Class) API 23

Should be:

getSystemService(String) API 1

getSystemService(context.JOB_SCHEDULER_SERVICE) API 21