メンバーユーザーの追加と削除
グループのメンバーとなるユーザーを追加または削除できます。
グループメンバーの追加
グループオーナーは addUser()
メソッドを使用してグループのメンバーを追加できます。
-
// Instantiate a user. Uri userUri = Uri.parse("Set the URI of an existing user here"); KiiUser user2 = KiiUser.createByUri(userUri); // Add the user to the group. group.addUser(user2); try { // Save the group on the server. group.save(); } catch (GroupOperationException e) { // Handle the error. }
-
// Instantiate a user. Uri userUri = Uri.parse("Set the URI of an existing user here"); KiiUser user2 = KiiUser.createByUri(userUri); // Add the user to the group. group.addUser(user2); // Save the group on the server. group.save(new KiiGroupCallBack() { @Override public void onSaveCompleted(int token, KiiGroup group, Exception exception) { if (exception != null) { // Handle the error. return; } } });
メンバー追加を反映させるために save()
メソッドを必ず実行してください。
グループメンバーの削除
グループオーナーは removeUser()
メソッドを使用してグループのメンバーを削除できます。
-
// Instantiate a user. Uri userUri = Uri.parse("Set the URI of an existing user here"); KiiUser user2 = KiiUser.createByUri(userUri); // Remove the user from the group. group.removeUser(user2); try { // Save the group on the server. group.save(); } catch (GroupOperationException e) { // Handle the error. }
-
// Instantiate a user. Uri userUri = Uri.parse("Set the URI of an existing user here"); KiiUser user2 = KiiUser.createByUri(userUri); // Remove the user from the group. group.removeUser(user2); // Save the group on the server. group.save(new KiiGroupCallBack() { @Override public void onSaveCompleted(int token, KiiGroup group, Exception exception) { if (exception != null) { // Handle the error. return; } } });
メンバー追加を反映させるために save()
メソッドを必ず実行してください。