F
F
Fotonick2016-11-17 13:21:38
Android
Fotonick, 2016-11-17 13:21:38

How to post a photo with a description on the wall of a Vkontakte user from your application?

I log in with a request for permissions to email and post on the wall

VKSdk.login(ActivityRegLog.this, VKScope.EMAIL, VKScope.WALL);

I'm trying to post as indicated in the documentation
VKRequest requestPost = VKApi.uploadWallPhotoRequest(new VKUploadImage(bitmap, VKImageParameters.jpgImage(0.9f)), 0, 60479154);
        requestPost.executeWithListener(new VKRequest.VKRequestListener() {
            @Override
            public void onComplete(VKResponse response) {
                Log.v("Upload", response.responseString);
            }

            @Override
            public void onError(VKError error) {
                Log.v("Upload", error.errorMessage);
            }

            @Override
            public void attemptFailed(VKRequest request, int attemptNumber, int totalAttempts) {
                Log.v("Upload", request.toString());
            }
        });

It constantly writes that there are no rights to call this method ((What am I doing wrong?
what do the last two parameters of the uploadWallPhotoRequest method mean, what are there for 0 and 60479154?
Maybe you need to substitute some values ​​\u200b\u200bthere? (Then why did they indicate exactly in the documentation these are numbers, not variables).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SnoUweR, 2018-11-22
@SnoUweR

I know that this is a necropost, but I’ll answer anyway (because I myself encountered this an hour ago).
Uploading a photo, for subsequent attachment to a post, calls the photos.getWallUploadServer method internally (in the SDK) . If you look at the documentation for this method, it says that you need photos permissions to use it .
Thus, when authorizing, you also need to make a permission request for VKScope.PHOTOS .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question