Android Question AppUpdating - Persistent Notification

ggranata

Member
Hi,
I use AppUpdating to update my app.
When a new version is found, my app sends an installation intent and triggers a persistent notification.
How I set no persistent notification ? Any ideas?
 

ddk1

Member
Licensed User
I find the same issue and I have tried hard to sort out Automatic Foreground Mode.
Suspiciously though, I have found that the same thing happens sometimes compiling my app in B4A with the mobile connected via USB debugging.
eg. Compile log says
Installing file to device. (3.73s)
Device serial: xxxxxxxxxx
Completed successfully.
Normally after this, the app will be running onscreen on the mobile, and there are no notifications from the app.
But occassionally, I find the app is not running and there is that same persistent notification. The answer is just to compile again and its usually ok the second time.
I have seen it compiling to various connected mobiles, different types and Android versions. Its so random though that I have no idea what is common to make the issue happen when compiling. And no idea what is in common with updating the app using its builtin AppUpdating function.
 
Upvote 0

ddk1

Member
Licensed User
For anyone who comes across this, I think I found the answer to the persistent notification, which is what Erel said above.
Up till now I had used AppUpdating.b4xlib as is. But having discovered its just an archive file that can be opened with 7Zip, I found it contained newinst2.bas, which is a service called after the install, whose purpose appears to be simply to reopen the app after the install. And this service does not have the now required Service.StopAutomaticForeground at the end of Service_Start.
Having solved that problem, it appears the service can't restart/reshow the app anyway, due to androids change that says 'StartActivity from a service will not work if there is no visible activity.' - see https://www.b4x.com/android/forum/threads/solved-appupdating-ver-2-05.144335/#content for more details on how this affects AppUpdating. BTW in that post Harris pointed out that refs to "main" need to change to Main. You can do this StartActivity(Main) still a no go.
Rather than muck around with 'draw over' permission, I'm ok with letting the user simply restart the app manually after. So I removed that service from the .b4xlib altogether, along with the ref to it in the manifest & cl_appupdate.bas.
And a big thanks to UDG for creating AppUpdating in the first place. A few tweaks are much easier than starting from scratch.
 
Last edited:
Upvote 0
Top