Android Question Keep app on foreground new method?

sorex

Expert
Licensed User
Longtime User
Hello,

Is there a way to keep an app running on the foreground that still works on newer android versions in all possible cases?

We use motorola phones for hallway sound monitoring but for some reason it sometimes brings up a page or pop-up about a new update that can be installed
which causes the app to go to the background and closes after a while.

Even when having the 2 update settings that I could find disabled and even notification settings disabled for almost everything.

What I notice is that it still works when you're in another app but not when you're on the home/desktop screen.

You can see that my app still executes every minute some data exchange to a backend but the start activity inthere is being ignored (when on the home screen).
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

sorex

Expert
Licensed User
Longtime User
I just tried it and indeed I get a page saying "Display in front of other apps" but then comes the culprit...

"this feature is not available" and it flashed between the app and that page forever.

I don't have an option to enable it either. (unless I try some hackery according to some videos I found about it)
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
this seems to work when connected via USB

B4X:
adb shell pm grant your.app.package.name android.permission.SYSTEM_ALERT_WINDOW

and under developer options enable "Allow screen overlays in settings"

now it works on the home, in the app list, under settings, when the pull down menu is visible (it's opened behind it tho).

for some reason I don't even need that special bring to front class either.
 
Upvote 0
Top