int latestUpdateCount = ... // Persist this value
// Each time you want to check for new and updated notes...
SyncState currentState = noteStore.getSyncState();
int currentUpdateCount = currentState.getUpdateCount();
if (currentUpdateCount > latestUpdateCount) {
// Something in the account has changed, so search for notes
NotesMetadataList newNotes = noteStore.findNotesMetadata( ... );
// Do something with the notes you found...
for (NoteMetadata note : newNotes.getNotes()) {
// ...
}
// Keep track of the new high-water mark
latestUpdateCount = currentSyncState.getUpdateCount();
}
|