You can use the method getTasksAssignedAsPotentialOwner (String userId, String language, TaskClientHandler.TaskSummaryResponseHandler responseHandler)
You dont need to mention the name of the groups.
The user group call back takes them by itself. All you need is to register the UserGroupCallback via UserGroupCallbackManager. You could use a property file to specify the mapping between the users and roles in the format :
userid1=group1,group2,group3
userid2=group4,group3,group1
userid3=group1,group2
...
...
And specify the path of this file in your CustomUserGroupCallBack.
So wehn you call the method taskClient.getTasksAssignedAsPotentialOwner (String userId, String language, TaskClientHandler.TaskSummaryResponseHandler responseHandler)
This will invoke the callback and will take the groups for the userId.