Last active
September 30, 2020 11:12
-
-
Save Sunilkumarr/a794a394902ae33942a803ddeab9f4e4 to your computer and use it in GitHub Desktop.
User details API call for checking if user exist or not.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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