KPACHblu
KPACHblu

Reputation: 51

Share Audio file with VK application

I'm trying to share audio files from my android app with other applications including VK: https://play.google.com/store/apps/details?id=com.vkontakte.android&hl=en The sharing functionality works fine with different applications, but not with VK. The code looks like:

    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_STREAM, fileUri);
    intent.setType(context.getContentResolver().getType(fileUri));
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    context.startActivity(intent);

In VK app during uploading process I get just "Error" without any information. In logcat I get the following error:

W/vk: com.vkontakte.android.upload.UploadException: can't save photo
                                          at com.vkontakte.android.upload.AudioUploadTask.c(AudioUploadTask.java:95)
                                          at com.vkontakte.android.upload.UploadTask.T_(UploadTask.java:78)
                                          at com.vkontakte.android.upload.UploaderIntentService.a(UploaderIntentService.java:68)
                                          at com.vkontakte.android.upload.UploaderIntentService.onHandleIntent(UploaderIntentService.java:42)
                                          at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:67)
                                          at android.os.Handler.dispatchMessage(Handler.java:105)
                                          at android.os.Looper.loop(Looper.java:156)
                                          at android.os.HandlerThread.run(HandlerThread.java:61)

I tried different mime types: "audio/*", "audio/mp3", "application/vnd.package.name", but no success.

Upvotes: 2

Views: 1536

Answers (1)

Vadims Savjolovs
Vadims Savjolovs

Reputation: 2668

I have also faced this issue. I tried to upload my mp3 file manually using VK app user interface and I had the same error as if I did it programmatically via share intent. Looks like VK Android app is just not allowing to upload and attach mp3 files to chat.

Works fine with every other file types.

Update

I have just tested and noticed one thing: some mp3 files are uploaded fine but some of them are not allowed. I have 2 ideas why it's happening:

  1. VK allows to upload mp3 files of certain length (e.g. min 3 sec, max 30 sec)

  2. There a bug in VK Android app which gives error when you upload some mp3 files

Upvotes: 2

Related Questions