database access - DB location?

Pelky

Active Member
Licensed User
Longtime User
I am using a Widget to allow me to touch the screen to start timing .. When I hit the widget again it writes a record away (sql). At a later date I need to update the record with details of my activities so am using an app to try and read and update those records...

How do I describe the Database to allow access from 1 or more apps and maybe to copoy across to a PC for further analysis?... Also how do you test the access on the PC ???

Thanks Guys
 

Pelky

Active Member
Licensed User
Longtime User
Thanks - I hear you but I am so new at this and am not sure what u mean. Will the database be available to multiple apps and if so how do i go about putting it on the SDK?...
I did get a DB reader but have no idea where B4 puts a database once created
 
Upvote 0

Pelky

Active Member
Licensed User
Longtime User
How about putting the database on the SDK and share it among the two applications? I am not sure if it will work but you may give it a try.

On a PC you just have to use some SQLite library and open the database.

Thanks - I hear you but I am so new at this and am not sure what u mean. Will the database be available to multiple apps and if so how do i go about putting it on the SDK?...
I did get a DB reader but have no idea where B4 puts a database once created
 
Upvote 0

DouglasNYoung

Active Member
Licensed User
Longtime User
Pelsky,
There is nothing to stop you putting the file on the root of the sd card, or a sub-directory, which will be available to any application. If you distribute the database with the apk then you just need to test for its existence on start up (Activity_Create) and copy it if its not already there. e.g.

B4X:
If FirstTime Then
   If File.Exists(File.DirRootExternal, "db_name") = False Then
      File.Copy(File.DirAssets, "db_name", File.DirRootExternal, "db_name")
   End If
End If
You could substitute File.DirRootExternal with File.DirDefaultExternal, which will put it in /Android/data/yourpackagename/file, which is visible also to all applications.

Have a look at Files - Basic4android Wiki

Hope this helps,
Douglas
 
Upvote 0

Pelky

Active Member
Licensed User
Longtime User
Douglas U R a Gods Send... Thanks very much....
I haven't tried it yet as I am up to my ears with other 'MAKE IT NICE' stuff but I will give it a go soon - looks like the answer tho...
It really is appreciated....
 
Upvote 0

Penko

Active Member
Licensed User
Longtime User
I am not sure if concurrent access is allowed but after all, it is just one application that can uses the database(unless it is a service but this is another story) and concurrency is not the case here.

Depending on what you want to achieve, you can upload data via FTP to your server, send via Sockets, etc...

Everything is up to you, B4A and Android system are both powerful enough to handle your needs.

Don't hesitate to ask for further help.
 
Upvote 0
Top