他ユーザーの属性の読み込み
ユーザーのユーザー名、メールアドレス、もしくは電話番号を指定することで、該当ユーザーの属性にアクセスできます。
読み取り可能なユーザー属性
他ユーザーの属性は読み取り操作のみ可能です。読み取り可能なユーザー属性は、アプリケーションの設定("ユーザー情報の全データを開示" オプション)によって決まります。詳細は ユーザー属性 をご覧ください。
アプリケーション設定の変更方法は ユーザー属性の開示範囲の設定 をご覧ください。
他ユーザー属性の取得
ユーザー名を指定してユーザー属性を取得
ユーザー名指定によるユーザー属性取得の例を以下に挙げます。取得処理を実行するユーザーは、ログインしている必要があります。
-
String username = "user_123456"; try { // Find a user by name. KiiUser found = KiiUser.findUserByUserName(username); } catch (IOException e) { // Handle the error. } catch (AppException e) { // Handle the error. }
-
String username = "user_123456"; // Find a user by name. KiiUser.findUserByUserName(username, new KiiUserCallBack() { @Override public void onFindCompleted(int token, KiiUser caller, KiiUser found, Exception exception) { if (exception != null) { // Handle the error. return; } } });
メールアドレスを指定してユーザー属性を取得
メールアドレス指定によるユーザー属性取得の例を以下に挙げます。指定するメールアドレスは認証済みである必要があります。また、取得処理を実行するユーザーは、ログインしている必要があります。
-
String email_address = "user_123456@example.com"; try { // Find a user by email address. KiiUser found = KiiUser.findUserByEmail(email_address); } catch (IOException e) { // Handle the error. } catch (AppException e) { // Handle the error. }
-
String email_address = "user_123456@example.com"; // Find a user by email address. KiiUser.findUserByEmail(email_address, new KiiUserCallBack() { @Override public void onFindCompleted(int token, KiiUser caller, KiiUser found, Exception exception) { if (exception != null) { // Handle the error. return; } } });
電話番号を指定してユーザー属性を取得:
電話番号指定によるユーザー属性取得の例を以下に挙げます。指定する電話番号は認証済みである必要があります。また、取得処理を実行するユーザーは、ログインしている必要があります。
なお、電話番号は、+と国コードから始まる国際電話番号で指定してください。
-
String phone_number = "+819012345678"; try { // Find a user by phone number. KiiUser found = KiiUser.findUserByPhone(phone_number); } catch (IOException e) { // Handle the error. } catch (AppException e) { // Handle the error. }
-
String phone_number = "+819012345678"; // Find a user by phone number. KiiUser.findUserByPhone(phone_number, new KiiUserCallBack() { @Override public void onFindCompleted(int token, KiiUser caller, KiiUser found, Exception exception) { if (exception != null) { // Handle the error. return; } } });
URI 指定でユーザー属性を取得:
URI 指定でユーザー属性を取得する例を以下に挙げます。取得処理を実行するユーザーは、ログインしている必要があります。
-
Uri uri = Uri.parse("Set the URI of an existing user here"); try { // Instantiate a user. KiiUser user = KiiUser.createByUri(uri); // Refresh the user. user.refresh(); } catch (IOException e) { // Handle the error. } catch (AppException e) { // Handle the error. }
-
Uri uri = Uri.parse("Set the URI of an existing user here"); // Instantiate a user. final KiiUser user = KiiUser.createByUri(uri); // Refresh the user. user.refresh(new KiiUserCallBack() { @Override public void onRefreshCompleted(int token, Exception exception) { if (exception != null) { // Handle the error. return; } } });
ユーザー ID 指定でユーザー属性を取得:
ユーザー ID 指定でユーザー属性を取得する例を以下に挙げます。取得処理を実行するユーザーは、ログインしている必要があります。
-
String userID = "Set the ID of an existing user here"; try { // Instantiate a user. KiiUser user = KiiUser.userWithID(userID); // Refresh the user. user.refresh(); } catch (IOException e) { // Handle the error. } catch (AppException e) { // Handle the error. }
-
String userID = "Set the ID of an existing user here"; // Instantiate a user. final KiiUser user = KiiUser.userWithID(userID); // Refresh the user. user.refresh(new KiiUserCallBack() { @Override public void onRefreshCompleted(int token, Exception exception) { if (exception != null) { // Handle the error. return; } } });