0

I'm using retrofit object to call my API but I keep getting

"java.net.ConnectException: Failed to connect to api.backtory.com/185.105.185.244:443"

in my onFailure method

I have set the title using @Headers
I have added INTERNET permission to my manifests
I have added the gson-converter library and retrofit as well

public class RegisterUserController {

  public void start(User user){

    Retrofit retrofit = new Retrofit.Builder()
            .baseUrl(ChatRoomAPI.BASE_URL)
            .addConverterFactory(GsonConverterFactory.create())
            .build();

    ChatRoomAPI chatRoomAPI = retrofit.create(ChatRoomAPI.class);

    Call<User> call = chatRoomAPI.registerUser(user);

    call.enqueue(new Callback<User>() {
        @Override
        public void onResponse(Call<User> call, Response<User> response) {

            Log.d("TAG" , "onResponse" + response.code());

        }

        @Override
        public void onFailure(Call<User> call, Throwable t) {

            Log.d("TAG" , "onFailure" + t.getCause());    //

        }
    });

  }

}
General Grievance
  • 4,555
  • 31
  • 31
  • 45

0 Answers0