ATO
ATO

Reputation: 574

Sinch Instant Messaging Android

I am using Sinch Instant Messaging API for Android. All the other changes are in place like changes in AndroidManifest etc. are in place.

I have added following in my Sinch Client Initialization.

sinchClient.setSupportMessaging(true);
sinchClient.setSupportManagedPush(true);

Now when I am sending message, its being sent without exceptions because I do see message sent count going up on my Sinch Dashboard. However, in my sender code I don't get any callbacks regarding message failed or message delivered. I do get message about Message Sent. Also the receiver never gets any callback.

I am assuming as I am using Sinch Push, I don't need any kind of server to connect to GCM. Sinch will auto route queries to my receiver.

Also both Sender and Receiver are logging in using the same API Key/Secret/Env.

Anyone has faced this before.

Upvotes: 1

Views: 325

Answers (1)

ATO
ATO

Reputation: 574

So I got this working not exactly sure which step helped me but this is the following what is did:

  1. Made my Android Manifest exactly the same as the Sinch Push example of course except the class names.
  2. Another important thing which I did which I feel might have solved though not 100% sure is the way I am initializing and registering Sinch Client in code. I changed it from

            sinchClient = Sinch.getSinchClientBuilder().context(this).userId(username).applicationKey(ApplicationConstants.SINCH_SANDBOX_API_KEY)
                    .applicationSecret(ApplicationConstants.SINCH_SANDBOX_API_SECRET).environmentHost(ApplicationConstants.SINCH_SANDBOX_API_URL).build();
            sinchClient.addSinchClientListener(this);
            sinchClient.setSupportMessaging(true);
            sinchClient.setSupportManagedPush(true);
            sinchClient.checkManifest();
            sinchClient.start();
            sinchClient.getMessageClient().addMessageClientListener(messageClientListener);
    

to

                sinchClient = Sinch.getSinchClientBuilder().context(this).userId(username).applicationKey(ApplicationConstants.SINCH_SANDBOX_API_KEY)
                .applicationSecret(ApplicationConstants.SINCH_SANDBOX_API_SECRET).environmentHost(ApplicationConstants.SINCH_SANDBOX_API_URL).build();
            sinchClient.setSupportMessaging(true);
            sinchClient.setSupportManagedPush(true);
            sinchClient.checkManifest();
            sinchClient.addSinchClientListener(this);
            sinchClient.getMessageClient().addMessageClientListener(messageClientListener);
            sinchClient.start();

Upvotes: 1

Related Questions