2016-02-25 72 views
1

我正在使用适用于Android的Sinch Instant Messaging API。 所有其他更改都已到位,如AndroidManifest等的更改已到位。Sinch Instant Messaging Android

我在我的Sinch客户端初始化中添加了以下内容。

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

现在,当我发送消息,其被无例外地发送,因为我看到的消息发送数量上我Sinch仪表盘上涨。但是,在我的发件人代码中,我没有收到有关邮件失败或邮件传递的任何回调。我收到关于消息发送的消息。接收机也不会得到任何回调。

我假设我正在使用Sinch Push,我不需要任何种类的服务器来连接到GCM。 Sinch会自动将查询路由到我的接收器。

Sender和Receiver都使用相同的API Key/Secret/Env登录。

之前有人遇到过这个问题。

回答

1

所以我得到这个工作不是很确定这一步帮助我,但是这就是下面是什么做的:

  1. 使我的Android清单完全一样的Sinch推例子当然除了类名。
  2. 我做的另一件重要的事情,我觉得可能已经解决了,但不是100%肯定的是我在代码中初始化和注册Sinch Client的方式。我改变了它从

     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); 
    

   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();