Problem with Skygear Chat library on Android application


#1

Hello, I’m developing an Android application and I want to use Skygear Chat library in it. But when I try to make a login or signupAnonymously I get this error message “java.net.UnknownHostException: Unable to resolve host “******.skygeario.com”: No address associated with hostname”

I do this in my application class

@Override
public void onCreate() {
super.onCreate();

Configuration config = new Configuration.Builder()
  .endPoint(SKYGEAR_END_POINT)
  .apiKey(SKYGEAR_API_KEY)
  .build();

Container.defaultContainer(this).configure(config);

}

and use this to login

skygear.getAuth().loginWithEmail("dvp.petrov@gmail.com", “Test123!”, new AuthResponseHandler() {
@Override
public void onAuthSuccess(Record user) {
String accessToken = skygear.getAuth().getCurrentAccessToken();
Log.i(“Skygear Login”, "onAuthSuccess: Got token: " + accessToken);
}

  @Override
  public void onAuthFail(Error error) {
    if (error.getCode() == Error.Code.INVALID_CREDENTIALS) {
      Log.e("Skygear Login", "Password incorrect");
    } else if (error.getCode() == Error.Code.RESOURCE_NOT_FOUND) {
      Log.e("Skygear Login", "No such email");
    } else {
      Log.e("Skygear Login", "onAuthFail: Fail with reason: " + error.getCode());
    }
  }
});

#2

Hi I think you need to replace the SKYGEAR_END_POINT and SKYGEAR_API_KEY with the hostname and api key you got from your app at skygear.io or deployment.