Scringo:openChat功能不起作用

时间:2014-06-26 03:45:07

标签: android scringo

我在Android上使用图书馆scringo。 " openChat"功能似乎不起作用。它什么都没做。这是我的代码。

我通读了他们的API: http://www.scringo.com/docs/api/android/

openChat函数应该打开与其他用户的1对1聊天。但那并没有发生。什么都没发生。所有其他功能都正常。 它甚至不记录任何错误或警告。

public class MainActivity extends Activity implements OnClickListener {

private Scringo scringo;
private Activity mainactivity;
private Button button;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mainactivity = this;
    setContentView(R.layout.activity_main);

    button = (Button) findViewById(R.id.button);
    button.setOnClickListener(this);

    Scringo.setAppId("MY-APP-ID");
    Scringo.setDebugMode(true);
    scringo = new Scringo(this);
    scringo.init();
    scringo.addSidebar();
    Scringo.loginWithEmail("a@testapp.com", "hi", new ScringoSignUpListener(){
        @Override
        public void onError(String arg0) {  
        }
        @Override
        public void onSuccess(String arg0) {
            Log.w("user",Scringo.getUserId());  
        }
    });
}
@Override
public void onClick(View arg0) {
    //I am using the ID of another user.
    //This does not work. Nothing happens. No error or warning either.
    Scringo.openChat(this, "Qk8vJs4fRE");  

    //This works fine. 
    //Scringo.openChatRooms(this); 
}
}

1 个答案:

答案 0 :(得分:0)

获取用户后应该调用openChat:

Scringo.getUserByScringoId("SOME_ID...", new ScringoGetUserListener() {
    @Override
    public void gotUser(ScringoUser user) {
        Scringo.openChat(MainActivity.this, "SOME_ID...");
    }
});