Widget Location in standby issue

I want to create a widget to get the time to go to a specific destination with the google api.
To get my current location in my Scriptable widget, I use « Location.current() » but when my phone is in standby mode I got this issue :

Please could you tell me if there is an another way to get location

I think it would be helpful to post your code around where you are fetching your location.