Android Question sync SQLite between B4A and B4J apps.

techknight

Well-Known Member
Licensed User
Longtime User
There is probably a better solution to this, but I am brainstorming how to share app settings between the two environments.

I am developing an android app which is a studio like app that is very extensive, setting up sequences, times, file paths, hotkeys, etc.

I want to save all those into a local sqlite database. But the studio app will connect back to a b4J app either via MQTT or something along those lines and that is the "player" app that is supposed to do everything the studio app tells it to do. like a content management system.

Thing is, if I setup b4j to have a sqlite database, it can hold the same exact filepath, sequence information, thumbnails, etc that gets pushed from the android device.

Is there an easy way to sync up a sqlite database? Maybe the actual sqlite file itself could be sent back and forth and re-opened?

I decided against an sqlite/mysql "server" because if the person takes the tablet home or uses his own device, and sets up everything he wants for the show, he can "save" it in his device and push it when he gets to the facility and connects to the player/server.

Maybe a better approach? just curious. Nothing is set in stone, I am still brainstorming the design/logic.

Thanks.
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
my insight is that jServer only work in a non-ui app.

i saw that mqtt can send playload as bytes() you can send anything with it but both sides need the same class name and type definition
B4X:
As B4XSerializator
 = serializator.ConvertObjectToBytes(m)
 = serializator.ConvertBytesToObject(Payload)

mqtt examples:
https://www.b4x.com/android/forum/threads/b4x-mqtt-chat-room.61568/

if client/server is in the same local network it would typical a tcp socket usage.
server wait and listen at a port, client connect, then send/received bidirectional data, close connection.

ftp would be an option but i think overwriting db's are not a good way.
 
Last edited:
Upvote 0

npsonic

Active Member
Licensed User
There is probably a better solution to this, but I am brainstorming how to share app settings between the two environments.

I am developing an android app which is a studio like app that is very extensive, setting up sequences, times, file paths, hotkeys, etc.

I want to save all those into a local sqlite database. But the studio app will connect back to a b4J app either via MQTT or something along those lines and that is the "player" app that is supposed to do everything the studio app tells it to do. like a content management system.

Thing is, if I setup b4j to have a sqlite database, it can hold the same exact filepath, sequence information, thumbnails, etc that gets pushed from the android device.

Is there an easy way to sync up a sqlite database? Maybe the actual sqlite file itself could be sent back and forth and re-opened?

I decided against an sqlite/mysql "server" because if the person takes the tablet home or uses his own device, and sets up everything he wants for the show, he can "save" it in his device and push it when he gets to the facility and connects to the player/server.

Maybe a better approach? just curious. Nothing is set in stone, I am still brainstorming the design/logic.

Thanks.
There is perfect solution for your problem called CloudKVS - synchronized key / value store.
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
If I use CloudKVS, I would have to dive into the details of how it works.

The user needs to be able to setup everything and configure everything in the app whether its connected to the "server" or not. Maybe add a save/load button so the operator can save it.

Then when connected to the server, "load" it and push everything to the server, or something.

But as far as internet, thats out. its a pure local onsite type of setup.
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
my insight is that jServer only work in a non-ui app.

i saw that mqtt can send playload as bytes() you can send anything with it but both sides need the same class name and type definition
B4X:
As B4XSerializator
 = serializator.ConvertObjectToBytes(m)
 = serializator.ConvertBytesToObject(Payload)

mqtt examples:
https://www.b4x.com/android/forum/threads/b4x-mqtt-chat-room.61568/

if client/server is in the same local network it would typical a tcp socket usage.
server wait and listen at a port, client connect, then send/received bidirectional data, close connection.

ftp would be an option but i think overwriting db's are not a good way.

I have been using MQTT already in some of my projects. It is not perfect for timing critical things, but otherwise it works great for sending/receiving data and messages.

I just dont/didnt't know if it can handle a mass load of data
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The user needs to be able to setup everything and configure everything in the app whether its connected to the "server" or not. Maybe add a save/load button so the operator can save it.
This is exactly the purpose of CloudKVS. To allow the clients to work offline and synchronize automatically when they are online.

I just dont/didnt't know if it can handle a mass load of data
I'm sure it can if it is configured properly.
 
Upvote 0
Top