java.lang.RuntimeException: Unable to start service com.entitcs.office_attendance.background_works.ServiceToGetJustLatLng@1c26787 with Intent { cmp=com.entitcs.office_attendance/.background_works.ServiceToGetJustLatLng }: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.entitcs.office_attendance/.background_works.MyLocationService }: app is in background uid UidRecord{c225bc5 u0a256 SVC idle change:uncached procs:1 seq(0,0,0)} at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4426) at android.app.ActivityThread.access$1900(ActivityThread.java:240) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2103) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:241) at android.app.ActivityThread.main(ActivityThread.java:7888) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:512) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:998) Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.entitcs.office_attendance/.background_works.MyLocationService }: app is in background uid UidRecord{c225bc5 u0a256 SVC idle change:uncached procs:1 seq(0,0,0)} at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1673) at android.app.ContextImpl.startService(ContextImpl.java:1608) at android.content.ContextWrapper.startService(ContextWrapper.java:680) at com.entitcs.office_attendance.background_works.ServiceToGetJustLatLng.c(Unknown Source:172) at com.entitcs.office_attendance.background_works.ServiceToGetJustLatLng.d(Unknown Source:34) at com.entitcs.office_attendance.background_works.ServiceToGetJustLatLng.onStartCommand(Unknown Source:69) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4389) ... 8 more