java.lang.RuntimeException: Unable to start activity ComponentInfo{com.entitcs.office_attendance/com.entitcs.office_attendance.activities.Drawer_Activity}: android.app.BackgroundServiceStartNotAllowedException: Not allowed to start service Intent { cmp=com.entitcs.office_attendance/.background_works.ServiceToGetJustLatLng }: app is in background uid UidRecord{7fd1511 u0a302 TPSL bg:+8m24s422ms idle change:procstateprocadj procs:0 seq(6728575,6728497)} caps=------- at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4645) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4853) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:112) at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:220) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:148) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:120) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:3079) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loopOnce(Looper.java:250) at android.os.Looper.loop(Looper.java:340) at android.app.ActivityThread.main(ActivityThread.java:9860) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:621) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:957) Caused by: android.app.BackgroundServiceStartNotAllowedException: Not allowed to start service Intent { cmp=com.entitcs.office_attendance/.background_works.ServiceToGetJustLatLng }: app is in background uid UidRecord{7fd1511 u0a302 TPSL bg:+8m24s422ms idle change:procstateprocadj procs:0 seq(6728575,6728497)} caps=------- at android.app.ContextImpl.startServiceCommon(ContextImpl.java:2025) at android.app.ContextImpl.startService(ContextImpl.java:1975) at android.content.ContextWrapper.startService(ContextWrapper.java:848) at android.content.ContextWrapper.startService(ContextWrapper.java:848) at com.entitcs.office_attendance.activities.Drawer_Activity.onCreate(Unknown Source:323) at android.app.Activity.performCreate(Activity.java:9374) at android.app.Activity.performCreate(Activity.java:9326) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1526) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4621) ... 13 more