Hi,
I have a development that requires that the app does not allow the device to go into energy savings.
I was reviewing the Uber app on Android for drivers and found that once you start the app the device does not go into energy savings while the app is in the foreground. When the user forces to enter another app an icon appears that allows to continue with the use of the app as shown in the figure.

How can I make my app work in the same way?