Skip to content

VK SDK Android

cover

Some Android-specific features built into Unofficial VK SDK for Android


Build Documentation Kotlin 1.3.72 API version GitHub license

The official VK Android SDK is monstrous, has poor API, does not contain some important features and their code leaves much to be desired. This is the reason why this SDK is created. See the available features below.

See the documentation: https://vksdk.github.io/vk-sdk-android

Auth

Android minSdkVersion Android targetSdkVersion

Latest version: maven-central

Authorization code flow is not supported by the official VK SDK and by the official app. But it is supported by this auth feature.

Easiest way to authorize user with VK and get the token:

Kotlin
// From here: https://vk.com/apps?act=manage
// Choose the app and get the ID from here: https://vk.com/editapp?id=XXX
// Or go here: https://vk.com/editapp?id=XXX&section=options and see the App ID

val callback = { result: VkAuthResult ->
    when (result) {
        is VkAuthResult.AccessToken -> {
            // do something with result.accessToken
        }
        is VkAuthResult.Error -> {
            // do something with result.error
        }
    }
}

// before activity.onCreate
val launcher = VkAuth.register(activity, callback)

// somewhere onClick
VkAuth.login(activity, launcher, params)

Install

Library is uploaded to the Maven Central Repository.

Add the following line to your dependencies:

Groovy
implementation "com.petersamokhin.vksdk.android:auth:$vkSdkAndroidVersion"

For other information and for details, see the documentation: https://vksdk.github.io/vk-sdk-android/auth/

License

See the License