Last active
October 16, 2017 20:11
-
-
Save Danil0v3s/9b5a4038d75bbb5825c72b97bf6808fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AppBaseService { | |
private static final AppBaseService ourInstance = new AppBaseService(); | |
private static String BASE_URL = "https://en.wikipedia.org/"; | |
private Retrofit retrofit; | |
private final static OkHttpClient okHttpClient = new OkHttpClient.Builder() | |
.readTimeout(2, TimeUnit.MINUTES) | |
.connectTimeout(2, TimeUnit.MINUTES) | |
.build(); | |
public static AppBaseService getInstance() { | |
return ourInstance; | |
} | |
private AppBaseService() { | |
retrofit = new Retrofit.Builder() | |
.baseUrl(BASE_URL) | |
.client(okHttpClient) | |
.addConverterFactory(GsonConverterFactory.create()) | |
.build(); | |
} | |
public WikipediaService getWikiService() { | |
return retrofit.create(WikipediaService.class); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment