Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS 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 184.108.40.206 release ready!
Owner and Founder. Opencart
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.
The support is fast and do everything in their power to make it perfect. If you need customization it's also done right away. I had massive research to select Mobikul and now I'm sure it was the right one.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.