Home > Net >  How to log in to VK using kotlin?
How to log in to VK using kotlin?

Time:02-10

As a result of executing this code, an activity appears to allow the application to access the vk profile. But if you allow access, the value of isLoggedIn remains false. Please tell me what I did wrong.

        var c: Collection<VKScope> = emptySet()
        c.plus(VKScope.FRIENDS)
        c.plus(VKScope.ADS)
        c.plus(VKScope.AUDIO)
        c.plus(VKScope.DOCS)
        c.plus(VKScope.EMAIL)
        c.plus(VKScope.GROUPS)
        c.plus(VKScope.MARKET)
        c.plus(VKScope.MESSAGES)
        c.plus(VKScope.NOTES)
        c.plus(VKScope.NOTIFICATIONS)
        c.plus(VKScope.NOTIFY)
        c.plus(VKScope.OFFLINE)
        c.plus(VKScope.PAGES)
        c.plus(VKScope.PHONE)
        c.plus(VKScope.PHOTOS)
        c.plus(VKScope.STATS)
        c.plus(VKScope.STATUS)
        c.plus(VKScope.STORIES)
        c.plus(VKScope.VIDEO)
        c.plus(VKScope.WALL)
        VK.initialize(applicationContext)
        VK.login(this, c)
    }

    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)

        var error = findViewById<TextView>(R.id.error)
        var ili = VK.isLoggedIn()
        error.text = ili.toString()
    }

CodePudding user response:

  •  Tags:  
  • Related