java.lang.RuntimeException: Unable to start service com.entitcs.office_attendance.background_works.ServiceToGetJustLatLng@b561d45 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{495e2af u0a226 SVC idle change:uncached procs:1 seq(0,0,0)} at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4319) at android.app.ActivityThread.access$2700(ActivityThread.java:273) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2070) at android.os.Handler.dispatchMessage(Handler.java:112) at android.os.Looper.loop(Looper.java:216) at android.app.ActivityThread.main(ActivityThread.java:7625) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987) 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{495e2af u0a226 SVC idle change:uncached procs:1 seq(0,0,0)} at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1810) at android.app.ContextImpl.startService(ContextImpl.java:1765) at android.content.ContextWrapper.startService(ContextWrapper.java:664) at com.entitcs.office_attendance.background_works.ServiceToGetJustLatLng.sendLatLongToServer(ServiceToGetJustLatLng.java:187) at com.entitcs.office_attendance.background_works.ServiceToGetJustLatLng.startLocationUpdates(ServiceToGetJustLatLng.java:127) at com.entitcs.office_attendance.background_works.ServiceToGetJustLatLng.onStartCommand(ServiceToGetJustLatLng.java:81) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4298) ... 8 more