I work in Android Studio. With the help of my program, you can publish a post in the VK community. Authorization done. Next You need to upload a photo to the server, but when I try to do this, I see an error in the console: enter image description here

Here is a piece of code where I perform actions:

ImageView imgVkPost = (ImageView) findViewById(R.id.imgVkPost); final Bitmap photo =((BitmapDrawable) imgVkPost.getDrawable()).getBitmap(); VKRequest request2 = VKApi.uploadWallPhotoRequest(new VKUploadImage(photo, VKImageParameters.jpgImage(0.9f)), 0, 60479154); request2.executeWithListener(new VKRequest.VKRequestListener() { @Override public void onComplete(VKResponse response) { super.onComplete(response); System.out.println(response.json.toString()); } @Override public void onError(VKError error) { Toast.makeText(getApplicationContext(), "Ошибочка вышла:(", Toast.LENGTH_SHORT).show(); System.out.println(error); } @Override public void attemptFailed(VKRequest request, int attemptNumber, int totalAttempts) { } }); 

How to be? What am I doing wrong?

  • In the login method, you gave the parameter access to the photo bay? - Sviat Volkov
  • one
    Oh oh oh. Exactly)) At first I thought that it would not matter, since the id was 0, but decided to try to transfer the scope - photos. And oh yeah, robit! Thank you so much for opening my eyes :) - Victor Shamruk
  • one
    @ Viktor Shamruk, you can write this in response - it can be useful for future visitors to this question, who will come here from search engines) - Yuriy SPb

1 answer 1

Access denied: no access to call this method

. An error occurs when logging in via the method

VKSdk.login(context, VKScope permissionParams...);

You did not transfer permishny to the appropriate operation. In your case, this is the perm on the bay photo.

PS My comment is a response