Reputation: 575
I'm new to android as well as to AWS. I have a java program which reads articles from some websites and store information (like title,link,description,date...) in a dynamoDB on AWS.
Now, I want to develop an Android application that will read the data. I guess that reading the data from the server each time the app starts would be wasteful, so I think I should save the data locally and just download updates from the DB whenever there are new entries. (I just add item to db, never update or something).
My question is what is the best way for doing this?
If there is another way of doing the same I'm open to learn.
Thank you.
Upvotes: 5
Views: 1377
Reputation: 409
Amazon provides Cognito for synchronizing local data with the sync store.
The synchronize method compares local cached data to the data stored in the Amazon Cognito Sync store. Remote changes are pulled from the Amazon Cognito Sync store; conflict resolution is invoked if any conflicts occur; and updated values on the device are pushed to the service.
It is not totally clear though if the sync store is a DynamoDB database. This link says:
The Amazon Cognito Sync store is a key/value pair store linked to an Amazon Cognito identity.
Upvotes: 1
Reputation: 200476
- how can I sync data from dynamoDB only when there are new entries?
You could possibly put some sort of settings file on the internet (perhaps on S3) for your Android app to check each time it opens. This file could contain the ID or timestamp of the last record inserted into DynamoDB. Your android app could then compare that to the local version to determine if it needs to pull updates from DynamoDB.
This is still a call out to the internet though. Depending on how much data you are storing in DynamoDB it might be just as fast to query DynamoDB directly every time. This would also add complexity to your data update process, requiring you to ensure that the file on S3 always gets updated.
- is sqlite is the best way to store this kind of data in android?
Yes that seems like the best place, although without knowing more about the amount and type of data you are storing it's hard to make a definitive recommendation.
Upvotes: 1