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:

// 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 appId = 1
val scopes = listOf(VkAuth.Scope.Offline, VkAuth.Scope.Email)

VkAuth.login(activity, appId, VkAuth.ResponseType.AccessToken, scopes) { result ->
    when (result) {
        is VkAuthResult.AccessToken -> {
            // do something with result.accessToken
        }
        is VkAuthResult.Error -> {
            // do something with result.error
        }
    }
}

Install

Library is uploaded to the Maven Central Repository.

Add the following line to your dependencies:

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

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

3rd party

License

See the License