Answer the question
In order to leave comments, you need to log in
How to get a list of online friends (VKApi)?
To get a list of all friends, I do the following query:
friendsListView = (ListView) view.findViewById(R.id.allFriendsList);
VKRequest request = VKApi.friends().get(VKParameters.from(VKApiConst.FIELDS, "first_name, last_name"));
request.executeSyncWithListener(new VKRequest.VKRequestListener() {
@Override
public void onComplete(VKResponse response) {
super.onComplete(response);
VKList list = (VKList) response.parsedModel;
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_expandable_list_item_1, list);
friendsListView.setAdapter(arrayAdapter);
}
});
VKRequest request = VKApi.friends().getOnline(VKParameters.from(VKApiConst.FIELDS, "online"));
Answer the question
In order to leave comments, you need to log in
Judging by the example in the documentation , if the online_mobile flag is not set to 1, then instead of the JSON object {online:[], online_mobile:[]} , just a JSON list with IDs comes, and you filter the result by the non-existent "online" key.
VKRequest request = new VKRequest("friends.getOnline");
А как выставить значение флага? метод from принимает key-value, но как это правильно задать?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question