Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 188.8.131.52 release ready!
Proto Datastore allows us to store custom type data. It uses protocol buffers to store data.
In share preference, we can only save data in key-value. DataStore allows us to store data in key-value pair and in form of object as well.
Proto DataStore is one way of DataStore to save data.
Please check my previous blog for datastore and preferences datastore : Preferences DataStore
We have to create a predefined schema in our project. This schema defines the type of object which we wanna store in Proto DataStore.
Suppose, we wanna save user data. We need to create a .proto file in our project. Lets say User.proto. Directory : app/src/main/proto/
NOTE: After creating User.proto file, please rebuild your android project.
Now, define a class which implements Serializer<T> , where T is the type defined in the proto file. This class will define how to read or write data.
Use createDataStore() function for creating instance of DataStore.
Get user id :
Get user name :
updateData method is used to save data in Proto DataStore.
To learn more about datastore, check following link : DataStore
Hopefully, this blog will be helpful for you.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We've bought a Shopware Extension which is a hybrid App, which we can now offer in the Google Play Store and the IOS App Store. I'am still impressed how fast and how sharp the support team leads us through every process of the App-Store clarification. Very fast and useful response.
Founder, Das Apartment Living
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.