I used Parse.com to download and store data in local database (for my offline app).
The download progress is normal. However, when I pin all list objects into local by using pinAllInBackground, it took so long time on device and crash on Genymotion (outofmemory). My data is more than 10000 records and maybe more.
This is my code:
private FindCallback getAllCardLocationRule(){
return new FindCallback<CardLocationRule>() {
@Override
public void done(final List<CardLocationRule> cardLocationRules, ParseException e) {
if (e == null) {
cardLocationRuleList.clear();
cardLocationRuleList.addAll(cardLocationRules);
final int limit = 1000;
ParseObject.pinAllInBackground(cardLocationRuleList, new SaveCallback() {
@Override
public void done(ParseException e) {
if (cardLocationRules.size() == limit) {
skip += limit;
Ln.i("myTrace: Skip: "+skip);
ParseQuery<CardLocationRule> query = ParseQuery.getQuery(CardLocationRule.class);
query.setSkip(skip);
query.setLimit(limit);
query.findInBackground(getAllCardLocationRule());
} else {
Ln.i("myTrace: Card Location Rule size: "+cardLocationRuleList.size());
ParseObject.pinAllInBackground(cardLocationRuleList, new SaveCallback() {
@Override
public void done(ParseException e) {
loadCards();
}
});
}
}
});
}
}
};
}