7.2 Get My Groups

The getMyGroups method returns all the groups, both public and private, current employee is member of.

Method parameters :

  • success: Success block to be executed after employee groups are successfully retrieved.

  • failure: Failure block to be executed if employee groups could not be retrieved, returns BayunError.

ArrayList<Group> myGroupsArray;

// Callbacks to get User's joined Groups
Handler.Callback success = new Handler.Callback() {
    @Override
    public boolean handleMessage(Message message) {
        Log.d(TAG, "Get my groups call successful.");
        myGroupsArray = (ArrayList<Group>)message.getData().getSerializable("BayunMyGroupsArray");
        for (Group group: myGroupsArray) {
            Log.d(TAG, "id: " + group.groupId);
            Log.d(TAG, "name: " + group.groupName);
            Log.d(TAG, "type: " + group.groupType);
        }
        return false;
    }
};

Handler.Callback failure = new Handler.Callback() {
    @Override
    public boolean handleMessage(Message message) {
        String error = message.getData().getString("BayunError", "");
        Log.d(TAG, "Error getting my groups.");
        return false;
    }
};

bayunCore.getMyGroups(success, failure);

Last updated