Getting the Owner of a Group

You can get the group owner with the getOwner() method.

Note that the KiiUser instance returned by the method only contains the ID. Execute the refresh() method to get the user's latest information from Kii Cloud.

If the returned user is different from the logged-in user, available user information is limited. For more information, see User Attributes.

The following sample code shows how to get the group owner.

  • 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.
          }
        });
      }
    });