Skip to content

Commit

Permalink
Synconization between local SQLite and Parse databases on install
Browse files Browse the repository at this point in the history
  • Loading branch information
mickey946 committed Mar 31, 2014
1 parent db82ea9 commit c3c8982
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 0 deletions.
Binary file modified TodoListManager/bin/TodoListManager.apk
Binary file not shown.
Binary file modified TodoListManager/bin/classes.dex
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
16 changes: 16 additions & 0 deletions TodoListManager/src/il/ac/huji/todolist/TodoTaskSQLiteHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,25 @@ public static TodoTaskSQLiteHelper getInstanse(Context context) {

@Override
public void onCreate(SQLiteDatabase database) {
// create local database
Log.i(TodoTaskSQLiteHelper.class.getName(),
"Creating database");
database.execSQL(DATABASE_CREATE);

// clear Parse database (delete all existing objects)
ParseQuery<ParseObject> query = ParseQuery.getQuery(_androidID);
query.whereExists("ID"); // actually this is all of the data
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> tasks, ParseException e) {
if (e == null) {
for(ParseObject task : tasks) {
task.deleteEventually();
}
} else {
// Well, shit.
}
}
});
}

@Override
Expand Down

0 comments on commit c3c8982

Please sign in to comment.