Android Question B4A application startup configuration options

AKJammer

Active Member
Licensed User
Quick question. I have a B4A application that connects to a MariaDB database. I had the connection string coded into the Process Globals sub as
Private const rdcLink As String = "http://mariadb:17178/rdc"

I figured with my mariadb hostname it wouldn't be a problem... It was.... When I moved everything over to a production environment, the tablets couldn't find the database. I scrambled and hard-coded the ip address as "http://192.168.1.51:17178/rdc", recompiled, redeployed to the 14 tablets and was ok, until the next time.

So I'd like to be able to read a configuration file that can be edited on the tablet to change the location of the database. Would this be a KVS2 solution? Or is KVS2 not editable outside of the program. Just a text file sitting someplace?

Thanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
It is actually not so simple as Android restricts access to all the shared files folders.
If you have access then I would have used a simple text file. KVS is not simple to edit.

One possible solution is to use ContentChooser to let the user (even if it is you) load external configuration files and then save them in XUI.DefaultFolder.
 
Upvote 0

cklester

Well-Known Member
Licensed User
In a text file (e.g., settings.txt) accessible (always) from your app, you can have something like:


You might be able to use a build command to indicate which one to be used at some time. Or you can just comment out the one to be ignored.


I basically do this with one of my company's apps. Of course, the only problem is if you ever lose access or change the location of the settings file! :oops:?
 
Upvote 0
Top