Answer the question
In order to leave comments, you need to log in
Send a photo to the wall of the VK group?
I can’t upload a photo to the wall in the group, I uploaded a photo to the photo3420_326050355 profile and received the url when passing VKApi.wall().post no photo, text message is
VKRequest request = VKApi.users().get(VKParameters.from(VKApiConst.FIELDS, FIELDS));
request.executeWithListener(new VKRequest.VKRequestListener() {
@Override
public void onComplete(VKResponse response) {
VKApiUser user = ((VKList<VKApiUser>) response.parsedModel).get(0);
String urlImage = user.photo_max;
VKApiPhoto photo = new VKApiPhoto();
attachments = new VKAttachments();
photo.photo_604 = urlImage;
attachments.add(photo);
Log.i("VK", " "+urlImage);
}
});
VKParameters.from(VKApiConst.OWNER_ID, -546456,
VKApiConst.ATTACHMENTS, attachments,
VKApiConst.MESSAGE, message);
Answer the question
In order to leave comments, you need to log in
The VKSDK readme contains an example of uploading a photo to a user's wall:
PhotoUpload serverResponse = vk.photos().getWallUploadServer(actor).execute();
WallUploadResponse uploadResponse = vk.upload().photoWall(serverResponse.getUploadUrl(), file).execute();
List<Photo> photoList = vk.photos().saveWallPhoto(actor, uploadResponse.getPhoto())
.server(uploadResponse.getServer())
.hash(uploadResponse.getHash())
.execute();
Photo photo = photoList.get(0);
String attachId = "photo" + photo.getOwnerId() + "_" + photo.getId();
GetResponse getResponse = vk.wall().post(actor)
.attachments(attachId)
.execute();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question