Java Code Examples for io.realm.Realm#setDefaultConfiguration()
The following examples show how to use
io.realm.Realm#setDefaultConfiguration() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppDelegate.java From AndroidSchool with Apache License 2.0 | 6 votes |
@Override public void onCreate() { super.onCreate(); sContext = this; Hawk.init(this) .setEncryptionMethod(HawkBuilder.EncryptionMethod.MEDIUM) .setStorage(HawkBuilder.newSharedPrefStorage(this)) .setLogLevel(BuildConfig.DEBUG ? LogLevel.FULL : LogLevel.NONE) .build(); RealmConfiguration configuration = new RealmConfiguration.Builder(this) .rxFactory(new RealmObservableFactory()) .build(); Realm.setDefaultConfiguration(configuration); ApiFactory.recreate(); RepositoryProvider.init(); }
Example 2
Source File: SaudeApp.java From Saude-no-Mapa with MIT License | 6 votes |
@Override public void onCreate() { super.onCreate(); Fabric.with(this, new Crashlytics()); Timber.plant(new Timber.DebugTree()); RealmConfiguration configuration = new RealmConfiguration.Builder(this) .deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(configuration); FacebookSdk.sdkInitialize(getApplicationContext()); Timber.i("Signature " + FacebookSdk.getApplicationSignature(getApplicationContext())); }
Example 3
Source File: AppDelegate.java From AndroidSchool with Apache License 2.0 | 6 votes |
@Override public void onCreate() { super.onCreate(); Hawk.init(this) .setEncryptionMethod(HawkBuilder.EncryptionMethod.MEDIUM) .setStorage(HawkBuilder.newSharedPrefStorage(this)) .setLogLevel(BuildConfig.DEBUG ? LogLevel.FULL : LogLevel.NONE) .build(); RealmConfiguration configuration = new RealmConfiguration.Builder(this) .rxFactory(new RealmObservableFactory()) .build(); Realm.setDefaultConfiguration(configuration); sAppComponent = DaggerAppComponent.builder() .dataModule(new DataModule()) .build(); }
Example 4
Source File: MainApplication.java From AndroidDatabaseLibraryComparison with MIT License | 6 votes |
@Override public void onCreate() { super.onCreate(); ActiveAndroid.initialize(new Configuration.Builder(this) .setDatabaseName("activeandroid") .setDatabaseVersion(1) .setModelClasses(SimpleAddressItem.class, AddressItem.class, AddressBook.class, Contact.class).create()); Ollie.with(this) .setName("ollie") .setVersion(1) .setLogLevel(Ollie.LogLevel.FULL) .init(); FlowManager.init(this); Sprinkles.init(this, "sprinkles.db", 2); RealmConfiguration realmConfig = new RealmConfiguration.Builder(this).build(); Realm.setDefaultConfiguration(realmConfig); mDatabase = getDatabase(); }
Example 5
Source File: AppDelegate.java From AndroidSchool with Apache License 2.0 | 6 votes |
@Override public void onCreate() { super.onCreate(); sContext = this; Hawk.init(this) .setEncryptionMethod(HawkBuilder.EncryptionMethod.MEDIUM) .setStorage(HawkBuilder.newSharedPrefStorage(this)) .setLogLevel(BuildConfig.DEBUG ? LogLevel.FULL : LogLevel.NONE) .build(); RealmConfiguration configuration = new RealmConfiguration.Builder(this) .rxFactory(new RealmObservableFactory()) .build(); Realm.setDefaultConfiguration(configuration); ApiFactory.recreate(); RepositoryProvider.init(); }
Example 6
Source File: PopularMoviesApplication.java From udacity-p1-p2-popular-movies with MIT License | 6 votes |
@Override public void onCreate() { super.onCreate(); // initialize the database RealmConfiguration.Builder realmConfigurationBuilder = new RealmConfiguration.Builder(this) .name(Realm.DEFAULT_REALM_NAME) .schemaVersion(DB_SCHEMA_VERSION); if (BuildConfig.DEBUG) { realmConfigurationBuilder.deleteRealmIfMigrationNeeded(); } RealmConfiguration realmConfiguration = realmConfigurationBuilder.build(); Realm.setDefaultConfiguration(realmConfiguration); // setup the Model so it can listen for and handle requests for data // hold a reference to it, to save it from GC mModel = new Model(); enableStrictMode(); }
Example 7
Source File: App.java From zhizhihu with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); sContext = getApplicationContext(); Realm.setDefaultConfiguration(new RealmConfiguration.Builder(getApplicationContext()).build()); if (AppConfig.isDebug) { Stetho.initializeWithDefaults(this); // 开启 Stetho 调试模式 Logger.init("=LingKu=").logLevel(LogLevel.FULL); } else { Logger.init().logLevel(LogLevel.NONE); } }
Example 8
Source File: MoviesApp.java From AndroidSchool with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); sInstance = this; Picasso picasso = new Picasso.Builder(this) .downloader(new OkHttp3Downloader(this)) .build(); Picasso.setSingletonInstance(picasso); RealmConfiguration configuration = new RealmConfiguration.Builder(this) .rxFactory(new RealmObservableFactory()) .build(); Realm.setDefaultConfiguration(configuration); }
Example 9
Source File: CharacterLocalDataSourceTest.java From Game-of-Thrones with Apache License 2.0 | 5 votes |
@Before public void setUp() { RealmConfiguration realmConfiguration = new RealmConfiguration .Builder(InstrumentationRegistry.getTargetContext()) .name("es.npatarino.android.gotchallenge.realm.test") .schemaVersion(1) .deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(realmConfiguration); dataSource = new CharacterLocalDataSource(ttlCachingStrategy, timeProvider, mapper); }
Example 10
Source File: MeiziApp.java From Meizi with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); Realm.setDefaultConfiguration(new RealmConfiguration.Builder(this) .schemaVersion(1) .deleteRealmIfMigrationNeeded() .build()); MeiziContext.getInstance().init(this); }
Example 11
Source File: DatabaseManager.java From redgram-for-reddit with GNU General Public License v3.0 | 5 votes |
@Inject public DatabaseManager(App app) { this.app = app; this.context = app.getApplicationContext(); this.configuration = new RealmConfiguration.Builder(context) // .name(DB_NAME) .deleteRealmIfMigrationNeeded() .setModules(this) .build(); Realm.setDefaultConfiguration(configuration); initCurrentAccessToken(); }
Example 12
Source File: UserRealmRepositoryTests.java From DebugRank with Apache License 2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); RealmConfiguration config = new RealmConfiguration.Builder(getContext()). schemaVersion(1). name("test.realm"). inMemory(). build(); Realm.setDefaultConfiguration(config); realm = Realm.getInstance(config); ILogger logger = mock(ILogger.class); repository = new UserRealmRepository(realm, logger); //every test method needs data ProgrammingLanguage language = new ProgrammingLanguage("java_8", "Java 8", ".java", 1); Puzzle puzzle = new Puzzle("basic_operator", "Basic Operator", 1, 2, 3, new String[]{"testcase"}, new String[]{"answer"}); repository.saveCompletedPuzzle(language, puzzle); language = new ProgrammingLanguage("javascript", "JavaScript", ".js", 2); puzzle = new Puzzle("basic_operator", "Basic Operator", 4, 5, 6, new String[]{"testcase"}, new String[]{"answer"}); repository.saveCompletedPuzzle(language, puzzle); }
Example 13
Source File: DataModule.java From mvvm-template with GNU General Public License v3.0 | 5 votes |
@Provides @Singleton RealmConfiguration provideRealmConfiguration(@ApplicationContext Context context) { int schemaVersion = 1; // first version Realm.init(context); RealmConfiguration realmConfig = new RealmConfiguration.Builder() .schemaVersion(schemaVersion) .migration((realm, oldVersion, newVersion) -> { // migrate realm here }) .deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(realmConfig); return realmConfig; }
Example 14
Source File: MyApplication.java From ApiClient with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(this) .deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(realmConfiguration); Github.init(); }
Example 15
Source File: App.java From buddysearch with Apache License 2.0 | 4 votes |
private void initRealm() { RealmConfiguration realmConfig = new RealmConfiguration.Builder(this) .deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(realmConfig); }
Example 16
Source File: App.java From syncapp with Apache License 2.0 | 4 votes |
private void initRealmConfiguration() { RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(this) .deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(realmConfiguration); }
Example 17
Source File: Monarchy.java From realm-monarchy with Apache License 2.0 | 4 votes |
/** * Initializes Realm as usual, except sets a default configuration to detect if a custom default is properly set. * * @param context app context */ public static void init(Context context) { Realm.init(context); invalidDefaultConfig = new RealmConfiguration.Builder().build(); Realm.setDefaultConfiguration(invalidDefaultConfig); }
Example 18
Source File: WelcomeActivity.java From my-first-realm-app with Apache License 2.0 | 4 votes |
private void setUpRealmAndGoToTaskListActivity() { SyncConfiguration configuration = SyncUser.current().getDefaultConfiguration(); Realm.setDefaultConfiguration(configuration); Intent intent = new Intent(WelcomeActivity.this, ProjectsActivity.class); startActivity(intent); }
Example 19
Source File: WelcomeActivity.java From my-first-realm-app with Apache License 2.0 | 4 votes |
private void setUpDefaultRealm() { Realm.setDefaultConfiguration(SyncUser.current().getDefaultConfiguration()); }
Example 20
Source File: RealmUtil.java From photosearcher with Apache License 2.0 | 3 votes |
public static void setupDatabase(Context context) { sRealmConfiguration = buildRealmConfiguration(context); Realm.setDefaultConfiguration(sRealmConfiguration); Realm.getDefaultInstance().close(); }