Skip to content

Instantly share code, notes, and snippets.

@yangweigbh
Last active July 16, 2020 14:42
Show Gist options
  • Save yangweigbh/ea3324562ffc3120bac07d145c90c24d to your computer and use it in GitHub Desktop.
Save yangweigbh/ea3324562ffc3120bac07d145c90c24d to your computer and use it in GitHub Desktop.
long lastExitTimestamp = getPreferences(0).getLong(PREV_DETECT_TIME_KEY, 0);
List<ApplicationExitInfo> unprocessedExitInfos = new ArrayList<>();
for (ApplicationExitInfo exitInfo: applicationExitInfos) {
if (exitInfo.getTimestamp() > lastExitTimestamp) {
unprocessedExitInfos.add(exitInfo);
} else {
break;
}
}
if (unprocessedExitInfos.size() > 0) {
getPreferences(0).edit().putLong(PREV_DETECT_TIME_KEY, unprocessedExitInfos.get(0).getTimestamp()).apply();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment