androidquickbloxquickblox-android

How to remove quickblox account user name from user list?


Basically I am retrieving QBUser list from quickblox server and I don't want Admin(application registered - account owner) name to be listed as QBUser.

Example :

I signup quickblox with name "A" to register "xyz" application. Afterwards I add certain users ("B","C","D") to application "xyz".

Now when I request user list API for "xyz" application I want only ("B","C","D") in response, but the issue is user list contains all users ("A","B","C","D").


Solution

  • I doubt there's a query to exempt a particular user from the query but you can handle that in your code when the user list is returned.

    QBPagedRequestBuilder pagedRequestBuilder = new QBPagedRequestBuilder();
    pagedRequestBuilder.setPage(1);
    pagedRequestBuilder.setPerPage(50);
    
    QBUsers.getUsers(pagedRequestBuilder, new QBEntityCallback<ArrayList<QBUser>>() {
    
    @Override
    public void onSuccess(ArrayList<QBUser> users, Bundle params) {
    
        for(QBUser user: users){
           if(user.getFullName().equals("A"))
               users.remove(user);
        }
    
        //go ahead to use users list without A
    
    }
    
    @Override
    public void onError(QBResponseException errors) {
    
    }
    });
    

    Hope it helps.