Skip to content

Instantly share code, notes, and snippets.

@Sunilkumarr
Last active September 30, 2020 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sunilkumarr/a794a394902ae33942a803ddeab9f4e4 to your computer and use it in GitHub Desktop.
Save Sunilkumarr/a794a394902ae33942a803ddeab9f4e4 to your computer and use it in GitHub Desktop.
User details API call for checking if user exist or not.
NOTE: Call this below API in ASYNC task or any other as this is server call.
CODE :
UserClientService userClientService = new UserClientService(MainActivity.this);
Set<String> userIds = new HashSet<>();
userIds.add("<RECIVER-USER-ID>"); // PASS the userID :
String response = userClientService.getUserDetails(userIds);
Log.i("USER", "The Response is :" + response);
if (TextUtils.isEmpty(response) || !TextUtils.isEmpty(response) && response.equals("error")) {
// Failed to fetch the details due some net issue or connecting issue
} else if (!TextUtils.isEmpty(response) && response.equals("[]")) {
// User is not register call the register API and wait for login API call success and launch the chat after that..
Log.i("USER", "NOT registered in applozic :" + response);
} else {
// User is already register launch the chat that user.
Log.i("USER", "registered user already:" + response);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment