Пример #1
0
 public static APIService getInstance() {
   Retrofit retrofit =
       new Retrofit.Builder()
           .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
           .addConverterFactory(JacksonConverterFactory.create())
           .baseUrl("http://api.map.baidu.com/")
           .build();
   apiService = retrofit.create(APIService.class);
   return apiService;
 }
Пример #2
0
  @Override
  public void onCreate() {
    super.onCreate();
    mInstance = this;

    mClient =
        new Retrofit.Builder()
            .baseUrl("https://app.kamcord.com")
            .addConverterFactory(JacksonConverterFactory.create())
            .build();
  }
 public static WeatherAPI createWeatherService(boolean isLoggerOn) {
   ObjectMapper mapper = new ObjectMapper();
   Retrofit.Builder builder =
       new Retrofit.Builder()
           .baseUrl(Constants.BASE_WEATHER_API_URL)
           .addConverterFactory(JacksonConverterFactory.create(mapper));
   if (isLoggerOn) {
     builder.client(createOkHttpClient());
   }
   Retrofit retrofit = builder.build();
   return retrofit.create(WeatherAPI.class);
 }
 public TwitterFriendsService(NamesService namesService) {
   this.namesService = namesService;
   this.authToken = System.getProperty(AUTH_TOKEN_PROPERTY);
   this.random = new Random(System.currentTimeMillis());
   Retrofit retrofit =
       new Retrofit.Builder()
           .baseUrl(TWITTER_BASE_URL)
           .client(createOkHttpClient())
           .addConverterFactory(JacksonConverterFactory.create())
           .build();
   this.twitterService = retrofit.create(TwitterService.class);
   LOG.info("Twitter service initialized");
 }