Some Android-specific features built into Unofficial VK SDK for Android
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
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§ion=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)
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/
See the License