I am new to Android, now I am working on a Project which is based on GPS. I got source code from internet(traccar). my requirement is like the app should update location on each 1Km or each 1hr. but the problem is the app not working in background after some time(10 - 20 mins). Is there any solution for this ?

> 
> what should I do(in code) to exclude this app from battery optimisation when the app is launching ? is it possible ?
> 
> 
>