Android Tutorial [B4X] CloudKVS - synchronized key / value store

luke2012

Well-Known Member
Licensed User
Longtime User
Hi @Erel.
First of all thanks for your great support about B4X CluodKVS

Is there a way to known all the users (es. User1, User2, User3...) within a CloudKVS store ?
I mean all the users that stored at least an item within the CloudKVS store.

In this way, different apps that deal within the CloudKVS can known all the users within a CloudKVS store.

For example, A "Supervisor" app that have to collect (display) all the items putted by all the users within a CloudKVS.

Thanks in advance for your reply.
 
Last edited:

luke2012

Well-Known Member
Licensed User
Longtime User

Thanks @Erel! This info helped me very much.

If I want to purge all data (ex. within my dev environment DB) I can run:

B4X:
sql.ExecNonQuery("delete from data")

Is this correct for the CloudKVS env?
 
Last edited:

luke2012

Well-Known Member
Licensed User
Longtime User
No, it will cause a mess. You shouldn't modify the data from the server. You should instead create a client and set the values to Null. You can use a B4J client that runs on the same computer as the server.

Ok. The client could be also an Android client (B4A client)?
 

wimpie3

Well-Known Member
Licensed User
Longtime User
1. Updating records is not possible? You can only delete/add them?
2. SSL is not supported on the server side?
 

wimpie3

Well-Known Member
Licensed User
Longtime User
2. But how? How can you add a certificate?

Will this lib still work when the user has a wrong date or time on their mobile?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User

luke2012

Well-Known Member
Licensed User
Longtime User
You can use a large random number as the key or to generate a random GUID: https://www.b4x.com/android/forum/threads/how-do-you-generate-a-guid.16195/#post-92012

The Good
@Erel I confirm you that I'm following your suggestion and I'm using a UUID for each new item putted in to the Cloud (works very well).
This UUID solve the problem of data updated by multiple clients at the same time (as you suggested) and I can have an solid unique item id.

The problem:
My problem now is that I can't display that UUID (very very long and impossible to remember) to the end user in order to let him identify the item within an item list and probably I need a progressive number to display to user within the App (ex. item n.1, item n.2 etc...).

Some custom item have a item name different from each item within the item list that I show within the app, but there are some custom items that doesn't have a name, but also some data (numeric data for example) but the end user cannot identify items because there haven't name or number (he can't see item n. 1 etc).

Any Idea?

Thanks in advance for your precious help.
 

luke2012

Well-Known Member
Licensed User
Longtime User

This statement convert a image file (.jpg, .png ...) into a byte array?
 

JakeBullet70

Well-Known Member
Licensed User
Longtime User
Hi all.

I have everything compiled and running on my VPS but am getting a connection refused error in b4a. I checked the nohup.out on the server and am getting this error. Any ideas?

Thanks.

 

luke2012

Well-Known Member
Licensed User
Longtime User
Hi to all,
I have an issue putting .jpg images within the CloudKVS.
I explain my issue with the follwing examples:

1) The following code works fine with the CloudKVS

B4X:
public Sub File2Byte (Dir As String, FileName As String) As Byte()
 Return Bit.InputStreamToBytes(File.OpenInput(Dir, FileName))
End Sub

myCustType.Pic = File2Byte (File.DirAssets, "13kb.png") 'Pic is a byte array declared within the custom type

starter.ckvs.Put("user1", "key1", myCustType)

2) The following code crash the CloudKVS Client (see the attached log)
Note that is the same code but with a 24bit jpg image (4160 x 3120 px - 3,42 MB)

B4X:
public Sub File2Byte (Dir As String, FileName As String) As Byte()
 Return Bit.InputStreamToBytes(File.OpenInput(Dir, FileName))
End Sub

myCustType.Pic = File2Byte (File.DirAssets, "3mb.jpg") 'Pic is a byte array declared within the custom type

starter.ckvs.Put("user1", "key1", myCustType)

My suspect is the file size.
How to workaround this issue and allow to load high res jpg?
 

Attachments

  • client_kvs_crash.PNG
    80.2 KB · Views: 313
Cookies are required to use this site. You must accept them to continue using the site. Learn more…