use of org.hisp.dhis.android.core.configuration.ConfigurationModel in project dhis2-android-sdk by dhis2.
the class D2Factory method create.
public static D2 create(String url, DatabaseAdapter databaseAdapter) {
ConfigurationModel config = ConfigurationModel.builder().serverUrl(HttpUrl.parse(url)).build();
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BASIC);
return new D2.Builder().configuration(config).databaseAdapter(databaseAdapter).okHttpClient(new OkHttpClient.Builder().addInterceptor(BasicAuthenticatorFactory.create(databaseAdapter)).addInterceptor(loggingInterceptor).build()).build();
}
use of org.hisp.dhis.android.core.configuration.ConfigurationModel in project dhis2-android-sdk by dhis2.
the class DataBaseMigrationShould method buildD2.
private void buildD2(DatabaseAdapter databaseAdapter) {
ConfigurationModel config = ConfigurationModel.builder().serverUrl(mockWebServer.url("/")).build();
d2 = new D2.Builder().configuration(config).okHttpClient(new OkHttpClient.Builder().addInterceptor(BasicAuthenticatorFactory.create(databaseAdapter)).build()).databaseAdapter(databaseAdapter).build();
}
Aggregations