Contentstack provides Android Persistence Library that lets your application store data on the device's local storage. This helps you build apps that can work offline too. Given below is a detailed guide and helpful resources to get started with our android Persistence Library.
You download below four files from Repository and keep it in your src folder.
- RealmStore * SyncManager * SyncPersistable
- SyncStore
To start using the library in your application, you will need to initialize it by providing the stack details:
Stack stack = Contentstack.stack(context, "apiKey", "accessToken", "environment");
//Provide realmInstance using
Realm realmInstance = Realm.getDefaultInstance();
//Provide realmInstance to RealmStore's constructor like below.
RealmStore realmStore = new RealmStore(realmInstance);
SyncManager manager = new SyncManager(realmStore, stack);
manager.stackRequest();
We have created an example app using android Persistence Library that stores data on the device's local storage. Read the tutorial to get started with the example app.