Advertisement
unholybin

ServiceCaller.java

Oct 11th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. public class ServiceCaller {
  2.  
  3.     private static final String BASE_URL = "https://example.com/";
  4.  
  5.     public static void startLicense(RequestLicense requestLicense, Callback<ResponseFromService> callback) {
  6.  
  7.         Gson gson = new GsonBuilder()
  8.                 .setLenient()
  9.                 .create();
  10.  
  11.         Retrofit retrofit = new Retrofit.Builder()
  12.                 .baseUrl(BASE_URL)
  13.                 .addConverterFactory(GsonConverterFactory.create(gson))
  14.                 .build();
  15.  
  16.         WebServiceAPI wsAPI = retrofit.create(WebServiceAPI.class);
  17.  
  18.         Call<ResponseFromService> call = wsAPI.sendDataForLicense(requestLicense);
  19.         call.enqueue(callback);
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement