Android Question Sync local SQLite database with a remote database

bennakhi1

Member
Licensed User
Longtime User
Hi,

I am working on a project that needs to sync local SQLite database on android device with a remote SQLite database on Raspberry Pi.

Each time I open my android app I must sync my local database with the master database on the Raspberry Pi. Does anyone has done this before ? any recommendations or suggestions ?

I am fixable, I don't have to stick to Raspberry Pi as master database. I can use any kind of web-server to do the job (etc. My PC, Hosting servers).

I have been searching the web on how to do that using PHP, but I haven't found any beneficial source. Besides, I don't know much about PHP.

Or someone have a better idea to sync my local database with the master database ?
 

bennakhi1

Member
Licensed User
Longtime User
Note that you can use B4J to develop Raspberry Pi apps.

You can write a small server program with B4J and then download the SQLite file from the board when the B4A app is started. The download will be done with HttpUtils2.

You can check the file date before you download.

Thanks for your help.
Where I should start from, is there a tutorial on how to do that ?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

bennakhi1

Member
Licensed User
Longtime User
Note that you can use B4J to develop Raspberry Pi apps.

You can write a small server program with B4J and then download the SQLite file from the board when the B4A app is started. The download will be done with HttpUtils2.

You can check the file date before you download.

Should I use SQlite or MySQL for the master database ? which one is easier ?

But I am flexible to use anything else as master database (etc. My PC or Web hosting services)
 
Last edited:
Upvote 0

eps

Expert
Licensed User
Longtime User
Personally I like working with SQLITE as the tools are quite lightweight. I only do simple databases in Apps though
 
Upvote 0

bennakhi1

Member
Licensed User
Longtime User
Personally I like working with SQLITE as the tools are quite lightweight. I only do simple databases in Apps though
I meant for the master database on the Raspberry Pi. But I am flexible to use anything else as master database (etc. My PC or Web hosting services)
 
Upvote 0

bennakhi1

Member
Licensed User
Longtime User
I am using the Raspberry Pi as a master database. What I should use for the master database SQLite or MySQL?
I just have two simple tables I am going to use for my app.
 
Upvote 0

bennakhi1

Member
Licensed User
Longtime User
It will also allow you to replace the existing database with a simple copy command.

I didn't understand what you mean by "replacing the existing database with a simple copy command" ?

How do you sync the the two databases the one on the phone and the other one on raspberry pi ( or my PC ) ?
I only have two simple tables in the database.
 
Upvote 0

bennakhi1

Member
Licensed User
Longtime User
See my answer in post #2.

But in your second post, you only suggesting that I can download the database from the board to the phone. But, I if I want to do the opposite? from the phone to the board ? I don't want only to copy the database, I need to keep the contents of the database up-to-date.
 
Upvote 0
Top