How an Android app developer can keep a device connected while in Sleep

2 Feb 2022

If you have an app that needs to continue running and performing specific functions, even while Android is in Sleep, you may need to use a foreground service for your app. A foreground service displays a visible notification while running and uses an intent to launch and keep specific functions running.

This option allows a Bluetooth connection, RS-232, or other connection and data logging to continue functioning, even if the device is in Sleep mode. Juniper Systems uses foreground services in our applications to enhance user experience such as with our Geode GNSS receiver.

See the Android for Developers Foreground Services documentation for more information about how foreground services work and how to start one for your app.