Android Question b4a Backwards compatibility

a n g l o

Active Member
Licensed User
Longtime User
Hi,
about 4 years ago i've purchased the b4a version that was released at that time.
i've wrote some applications and then, due to many reasons, stopped developing (and using b4a) until now.
now, i want to add new features to one of those apps, and i see that b4a is free.
i spent quite a time reading here trying to feel how much changed, and of course, trying to focus on
issues i'll need to deal with if i want to install the current free version.

1st issue : i've read here that now, under android 10 the app can't address DirExternal anymore and read about the option to address
DirDefaultExternal . well, I MUST address DirExternal . (BTW - can i address it by manipulating the string returned of DirDefaultExternal ? my guess is no)
The app old apk file installs with no problem on android 10 and running commands dealing with DirExternal on android 10.
I assume that's because it was built on the old b4a version.
but what if i load the project in the current b4a version ? i assume i won't be able to compile it as is.
I have the old b4a installation. should i better use that ?

2nd issue : DoEvents.....old time subject. i'm familiar with all arguments and discussions since vb days...
the application in subject use heavy recursive subs/loops that take alot of time, so the app must "keep the user in the picture"....
in the last 4 years it was heavily used without any crashes or stubility issues.
so maybe it depends on who or/and how using it (right for anything).
i'm reading here that now DoEvents gets a "deprecated warning" but still supported.
my question here : if i stick to b4a for a long long time of continuing maintaining the app -
can i trust that DoEvents will always remain supported ?

Thank you
 

Geezer

Active Member
Licensed User
Longtime User
1st Issue. Why do you need to access DirExternal ? If you are just accessing your app's external folder take a look at runtime permissions,

Use RuntimePermissions.GetSafeDirDefaultExternal("") instead of File.DirDefaultExternal. The parameter passed is an optional subfolder that will be created under the default folder.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Don't confuse new requirements related to Google Play or new versions of Android with B4A backward compatibility.
The backward compatibility policy is explained here: [B4X] Backward Compatibility

I have the old b4a installation. should i better use that ?
Of course not and it will not help in anything.
Read this: android.jar / targetSdkVersion / minSdkVersion

my question here : if i stick to b4a for a long long time of continuing maintaining the app -
can i trust that DoEvents will always remain supported ?
DoEvents will be kept as long as possible.
I treat code with DoEvents as broken code and I assure you that you will get crashes from time to time related to DoEvents (same with modal Msgbox).
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Use the latest B4A. If you don't need to put your app in the Play Store just target SDK 28 in the manifest and it will work as before assuming you are already requesting runtime permission for PERMISSION_WRITE_EXTERNAL_STORAGE

Become familiar with Resumable Subs and replace your DoEvents by Sleep(0). It is not directly equivalent as Sleep causes an immediate return from the Sub followed by a later e-entry at the Sleep point so there are ramifications if that Sub is called from another. but the effort to change to it will be worth it in the long run if you plan to maintain the app for some years to come.
 
Upvote 0

a n g l o

Active Member
Licensed User
Longtime User
thank you agraham and especialy erel on your detailed reply.
sorry for replacing sdk versions changes with b4a issue, BUT you know, for the small developer (me), it's him against the rest of the world that keeps changing all the time on him....
i suppose sdk 28 will do for me with the DirExternal issue, but i wonder what will do a developer who'll want to write a new files manager (for example) or to update existing one on the store. sdk 28 wont do for him...
of course i'll give the time needed to check if the sleep(0) do the work for me.
Thanks again
 
Upvote 0
Top