Skip to content

Instantly share code, notes, and snippets.

@ibrahimsn98
Created July 6, 2018 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ibrahimsn98/b95a9397012b2266093ddb735c8a7cf3 to your computer and use it in GitHub Desktop.
Save ibrahimsn98/b95a9397012b2266093ddb735c8a7cf3 to your computer and use it in GitHub Desktop.
android-mvvm-with-dagger-2-module-network
@Module
public class NetworkModule {
private static final String BASE_URL = "https://api.github.com/";
@Provides
static Retrofit provideRetrofit() {
return new Retrofit.Builder().baseUrl(BASE_URL)
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.build();
}
@Provides
static RepoService provideRepoService(Retrofit retrofit) {
return retrofit.create(RepoService.class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment