0

I am using the library scringo on Android. "openChat" function doesn't seem to be working. It does absolutely nothing. Here is my code.

I read through their API: http://www.scringo.com/docs/api/android/

openChat function should open the 1-on-1 chat with the other user. But that doesnt happen. Nothing happens. All the other functions are working fine. It doesn't even log any errors or warning.

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 Answers1

0

You should call the openChat after getting the user:

Scringo.getUserByScringoId("SOME_ID...", new ScringoGetUserListener() {
    @Override
    public void gotUser(ScringoUser user) {
        Scringo.openChat(MainActivity.this, "SOME_ID...");
    }
});
Kalisky
  • 1,141
  • 1
  • 9
  • 18