Start a new topic
Answered

Could not save with dataStore.save

Hi. 

I've written an app with Kinvey several years ago, and I wished to make some upgrades. However, I found that the coding had changed recently, so I'm trying to adapt my app into the new versions of Kinvey libraries. 


The major problem is that I couldn't upload entities into my Kinvey database with the dataStore.save(Entity, KinveyClientCallback) method. It would run to onSuccess. I have checked that the values in my entity was correct.  It seemed that it worked without an error, but my collection was still empty no matter how I tried. 


It might seem quite stupid, but I really need your expertise advice. Thank you. 


Work with Android Studio 3.1.4 

compile SDK version v3.1.4

API version 28

 implement all libraries as the Kinvey Sample App 

build with classpath 'com.android.tools.build:gradle:3.2.0-alpha17' 

dependencies include: 

implementation fileTree(dir: 'libs', include: ['*.jar']) 

testImplementation 'junit:junit:4.12' 

implementation 'com.android.support:appcompat-v7:28.0.0-alpha1' 

implementation 'com.android.support:design:28.0.0-alpha1' 

implementation 'com.android.support:multidex:1.0.1' 

implementation ':kinvey-android:+@aar' 

implementation ':realm-android-library:+@aar' 

implementation ':relinker:+@aar' 

implementation 'com.android.support.constraint:constraint-layout:1.1.3'


(the corresponding app on kinvey was named "CKDDIET")


Best Answer

Hi Kelvin,


I have implemented your use case in my environment with some additional code, and Its working.


As mention in the provided screenshot you are using StoreType.SYNC

Configuring your datastore as a Sync datastore allows you to pull a copy of your data to the device and work with it completely offline. The library provides APIs to synchronize local data with the backend. This type of datastore is ideal for apps that need to work for long periods without a network connection.


Means your save operation was completed locally but not pushed to the backend.

StoreType.SYNC require additional code to push your local data change to the backend, Please check this documentation.


If SYNC is not your requirement , you can use StoreType.NETWORK Instead.


Let me know if it helps.


Regards,

Prabhat T.


Hi Kelvin,


Thank you for providing details information about your use case.

I am looking into this now, I will get back to you with questions and suggestions shortly.


Regards,

Prabhat T.

Answer

Hi Kelvin,


I have implemented your use case in my environment with some additional code, and Its working.


As mention in the provided screenshot you are using StoreType.SYNC

Configuring your datastore as a Sync datastore allows you to pull a copy of your data to the device and work with it completely offline. The library provides APIs to synchronize local data with the backend. This type of datastore is ideal for apps that need to work for long periods without a network connection.


Means your save operation was completed locally but not pushed to the backend.

StoreType.SYNC require additional code to push your local data change to the backend, Please check this documentation.


If SYNC is not your requirement , you can use StoreType.NETWORK Instead.


Let me know if it helps.


Regards,

Prabhat T.

Hi Prabhat T., Thanks very much for your time and assistance. Sorry that I didn't have time to reply in weekdays. This should be the main reason that my code wasn't working. I'll get more understanding into it. Thank you for pointing out the problem. Best regards, Kelvin
Login or Signup to post a comment