In Google Nearby Connections API, is there any way to keep advertise on while the app is off?

I am trying to create an app where users can see the information of other users in a nearby area(30m). I decided to use Google Nearby Connections API(P2P_CLUSTER), as I want users to be able find other users, as well as be found by other users.
In Google Nearby Connections API, would there be any way to keep advertise on so that when a certain user tries to discover other users nearby, other users would be discovered even when they do not have their apps on? Or would there be any other API better suited for this task?

I am using Android Kotlin and firebase.

Answer

The best way to do such tasks is to use the Service in the app.

Services allow the app app to run some imp task whilw the app is off.

You can learn more about Service through google and youtube.
Its the best way to do it, And remommended way.