オーナーユーザーの取得
グループのオーナーは getOwner()
メソッドで取得できます。
返却される KiiUser
のインスンタンスは ID
のみを保持した不完全なインスタンスであることに注意してください。必要に応じて refresh()
メソッドを実行して Kii Cloud よりユーザーの最新情報を取得してください。
なお、取得するユーザーとログイン中のユーザーが異なる場合、取得できる情報に制限があります。詳細は ユーザー属性 を参照してください。
グループのオーナーを取得するサンプルコードを以下に示します。
-
try { // Get the owner user of the group. KiiUser owner = group.getOwner(); // Refresh the owner to retrieve the latest data from Kii Cloud. owner.refresh(); // Do something. } catch (GroupOperationException e) { // Handle the error. }
-
// Get the owner user of the group. group.getOwner(new KiiGroupCallBack() { @Override public void onGetOwnerCompleted(int token, KiiGroup group, KiiUser owner, Exception exception) { if (exception != null) { // Handle the error. return; } // Refresh the owner to retrieve the latest data from Kii Cloud. owner.refresh(new KiiUserCallBack() { @Override public void onRefreshCompleted(int token, Exception exception) { if (exception != null) { // Handle the error. return; } // Do something. } }); } });