S sorex Expert Licensed User Longtime User Nov 19, 2025 #1 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).
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 Nov 19, 2025 #2 Services can not start an Activity when the app is in background. From https://www.b4x.com/android/forum/threads/android-jar-targetsdkversion-minsdkversion.87610/ StartActivity from a service will not work if there is no visible activity. As a workaround you can request the special "draw over apps" permission: https://www.b4x.com/android/forum/threads/draw-on-top-of-other-apps-permission.90513/ It will allow StartActivity to work. Click to expand... Upvote 0
Services can not start an Activity when the app is in background. From https://www.b4x.com/android/forum/threads/android-jar-targetsdkversion-minsdkversion.87610/ StartActivity from a service will not work if there is no visible activity. As a workaround you can request the special "draw over apps" permission: https://www.b4x.com/android/forum/threads/draw-on-top-of-other-apps-permission.90513/ It will allow StartActivity to work. Click to expand...
S sorex Expert Licensed User Longtime User Nov 19, 2025 #3 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
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)
DonManfred Expert Licensed User Longtime User Nov 19, 2025 #4 Sorry, i can´t help any further here. You need to wait for another - maybe more helpful - answer, sorry. Upvote 0
Sorry, i can´t help any further here. You need to wait for another - maybe more helpful - answer, sorry.
S sorex Expert Licensed User Longtime User Nov 19, 2025 #5 this seems to work when connected via USB Code: Copy 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
this seems to work when connected via USB Code: Copy 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.