1

I initialized my twilio client in the code below but I am getting an error

Unable to establish connection to Twilio Sync service

My code:

 public void build(String token,  TaskCompletionListener<ChatClient, String> listener) {
    ChatClient.Properties props =
            new ChatClient.Properties.Builder()
                    .setRegion("us1")
                    .createProperties();
    this.buildListener = listener;
    //Toast.makeText(context,"++-==++",Toast.LENGTH_LONG).show();
    ChatClient.create(context.getApplicationContext(),
            token,
            props,
            new CallbackListener<ChatClient>()
            {
                @Override
                public void onSuccess(ChatClient chatClient) {
                    Toast.makeText(context,chatClient.getMyIdentity(),Toast.LENGTH_LONG).show();
                }

                @Override
                public  void onError (ErrorInfo errorInfo)
                {
                   Log.e("++==00",errorInfo.getMessage());
                   Toast.makeText(context,errorInfo.getMessage(),Toast.LENGTH_LONG).show();
               }
            });
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Are you generating your token correctly? You can test it with a tool like http://jwt.io/ to make sure you have grants for Chat and that your secret key has been used correctly to sign it. – philnash Mar 05 '19 at 02:49

0 Answers0