vk - User info from VKontakte in Android -
i writing application needs use user data taken client social network vkontakte. did authorize vkontakte.
vksdk.initialize(sdklistener, string.valueof(idvk), vkaccesstoken.tokenfromsharedpreferences(this, stokenkey));
and got accesstoken. name , email user?
you can request email scope user, email access token:
string email = vksdk.getaccesstoken().email; string userid = vksdk.getaccesstoken().userid; //get user info vkapi.users().get().executewithlistener(new vkrequest.vkrequestlistener() { @override public void oncomplete(vkresponse response) { vkapiuser user = ((vklist<vkapiuser>)response.parsedmodel).get(0); log.d("user name", user.first_name + " " + user.last_name); } });
but remember, email available after first access request.
old answer:
can't email. not available. can user name:
vkapi.users().get().executewithlistener(new vkrequest.vkrequestlistener() { @override public void oncomplete(vkresponse response) { vkapiuser user = ((vklist<vkapiuser>)response.parsedmodel).get(0); log.d("user name", user.first_name + " " + user.last_name); } });
Comments
Post a Comment