To start using SDK functionality, you first need to login to your website using SDK. Using SDK you can login by 2 ways:
The syntax of this login method is as follows :
Login(String USER_NAME, String PASSWORD,Callbacks callback)
e.g
ccometchat.Login("jane", "mypassword",new MyCallback(successObj=>this.onSucess(successObj)));
Where MyCallback is as follows :
class MyCallback : Java.Lang.Object, ICallback{
Action <Org.Json.JSONObject> _onSuccess;
Action <Org.Json.JSONObject> _onFail;
public MyCallback(Action<Org.Json.JSONObject> onSuccess, Action<Org.Json.JSONObject> onFail = null)
{
this._onFail = onFail;
this._onSuccess = onSuccess;
}
void SuccessCallbac(JSONObject){...}
void FailCallback(JSONObject){...}
}
If you have logged in successfully, the successCallback will be fired containing the following response :
{"message": "Login successful"}
You can also login to CometChat by using your UserID.
The syntax of this login method is as follows:
Login(String USER_ID,Callbacks callback)
e.g
cometchat.Login("15",new MyCallback(successObj=>this.onSucess(successObj)));
The success response will be same as of above.
Calling this function will end the current session and clears user data.
The syntax is as follows :
Logout(Callbacks callback)
e.g
cometchat.Logout(new MyCallback(successObj=>this.onSucess(successObj)));
Not finding what you need?
The CometChat team is here to help!