Skip to content

Instantly share code, notes, and snippets.

@oznus
Created March 21, 2015 14:15
Show Gist options
  • Select an option

  • Save oznus/df2e21603dab54a76cbb to your computer and use it in GitHub Desktop.

Select an option

Save oznus/df2e21603dab54a76cbb to your computer and use it in GitHub Desktop.
Init Couchbase lite Database
public void initDB(Context context) {
try {
Manager manager = new Manager(new AndroidContext(context), Manager.DEFAULT_OPTIONS);
if (!Manager.isValidDatabaseName(DBName)) {
throw new RuntimeException("Bad database name");
}
database = manager.getDatabase(DBName);
} catch (IOException e) {
throw new RuntimeException("Cannot create manager object");
} catch (CouchbaseLiteException e) {
throw new RuntimeException("Cannot get database");
}
Log.d (TAG, "Database created");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment