VK Bridge events on OK
The page features events supported by OK. Some events work differently on VK and OK, which is indicated in the table. Please take these differences into account when developing apps.
Service events
Event | Platforms | Features |
|---|---|---|
VKWebAppInit
Initialize VK Bridge. | Android
iOS
Mobile Web
Web | |
VKWebAppGetLaunchParams
Get app launch parameters. | Android
iOS
Mobile Web
Web | The vk_platform parameter communicates the platform the app is launched on:
• desktop_web_ok — desktop website.
• mobile_android_ok — Android app.
• mobile_iphone_ok — iOS app.
• mobile_web_ok — mobile browser. |
VKWebAppGetClientVersion
Get information about the VK platform the app is launched on. | Android
iOS
Mobile Web
Web | The following returns in the platform field:
• web-ok — if the app is launched on the desktop website.
• android — if the app is launched on the Android mobile client.
• ios — if the app is launched on the iOS mobile client.
• mobile-web-ok — if the app is launched in the mobile browser. |
VKWebAppCallAPIMethod
Call the VK API method. | Android
iOS
Mobile Web
Web |
Access and permissions
Event | Platforms | Features |
|---|---|---|
VKWebAppGetAuthToken
Request user data access. | Android
iOS
Mobile Web
Web | The append_local parameter indicates which platform to get an access token for. Possible values:
• true — get an access token for the platform that uses the SDK (for example, OK).
• false — get an access token for VK. Default value.
The access token will be returned in the response in the local_access_token field. |
VKWebAppCheckAllowedScopes
Get the list of data the app has access to. | iOS
Mobile Web
Web | |
VKWebAppGetGrantedPermissions
Get the list of permissions given to the mobile OK app. | Android
iOS |
Interface
Event | Platforms | Features |
|---|---|---|
VKWebAppResizeWindow
Resize the app window. | Web | |
VKWebAppSetViewSettings
Adjust the view of app controls: status bar, action bar and navigation panel. | Android
iOS |
Navigation
Event | Platforms | Features |
|---|---|---|
VKWebAppSetLocation
Set the hash value in the address bar for navigation inside the app. | Android
Mobile Web
Web | |
VKWebAppSetSwipeSettings
Enable the "swipe back" gesture. | iOS | |
VKWebAppOpenApp
Open another app from the current one. | Mobile Web
Web | The app_is_local parameter determines which platform’s app should be opened. Possible values:
• true — open an app of the platform that uses the SDK (for example, OK).
• false — open a VK mini app. Default value. |
VKWebAppClose
Close the app. | Android
iOS
Mobile Web
Web | |
VKWebAppScroll
Scroll the app window up and down. | Mobile Web
Web | |
VKWebAppScrollTop
Get the current scroll position relative to the top of the app's parent window. | Web | |
VKWebAppScrollTopStart
Start sending events about parent window scrolling. | Web | |
VKWebAppScrollTopStop
Stop sending scrolling events started by the event. VKWebAppScrollTopStart | Web |
Monetization
Ads
Event | Platforms | Features |
|---|---|---|
VKWebAppCheckNativeAds
Check if there are ad materials available to show on the user's side. | Android
iOS
Mobile Web
Web | |
VKWebAppShowNativeAds
Show an ad. | Android
iOS
Mobile Web
Web |
Banners
Event | Platforms | Features |
|---|---|---|
VKWebAppShowBannerAd
Show a banner ad. | Android
iOS
Mobile Web
Web | |
VKWebAppCheckBannerAd
Check if a banner ad was shown. | Android
iOS
Mobile Web
Web | |
VKWebAppBannerAdUpdated
Get a banner ad update status. | Android
iOS
Mobile Web
Web | |
VKWebAppHideBannerAd
Hide a banner ad. | Android
iOS
Mobile Web
Web | |
VKWebAppBannerAdClosedByUser
Report that the user closed an ad banner. | Android
iOS
Mobile Web
Web |
Purchasing
Event | Platforms | Features |
|---|---|---|
VKWebAppShowOrderBox
Open the purchase window. | Android
iOS
Mobile Web
Web | |
VKWebAppShowSubscriptionBox
Show the purchase, order cancel or subscription renewal window. | Android
iOS
Mobile Web
Web |
Analytics
Event | Platforms | Features |
|---|---|---|
VKWebAppRetargetingPixel
Add the user to the retargeting audience. | Android
iOS
Mobile Web
Web | |
VKWebAppTrackEvent
Send data to MyTracker. | Android
iOS
Mobile Web
Web |
Users and communities
Users
Event | Platforms | Features |
|---|---|---|
VKWebAppGetEmail
Request access to user's email address. | iOS
Mobile Web
Web | |
VKWebAppGetFriends
Show user's friends list. | Android
iOS
Mobile Web
Web | |
VKWebAppGetPhoneNumber
Request access to user's phone number. | iOS
Mobile Web
Web | |
VKWebAppOpenContacts
Request access to user's phone contacts. | Android
iOS | |
VKWebAppGetUserInfo
Obtain data from user's profile. | Android
iOS
Mobile Web
Web | The use_local parameter determines which platform to get data from. Possible values:
• true — from the platform that uses the SDK, for example OK.
• false — VK. Default value. |
Communities
Event | Platforms | Features |
|---|---|---|
VKWebAppAddToCommunity
Add an app to the community. | Android
iOS
Mobile Web
Web | |
VKWebAppAllowMessagesFromGroup
Obtain permission to send messages on behalf of the community. | Android
iOS
Mobile Web
Web | |
VKWebAppGetGroupInfo
Get information about the community. | Android
iOS
Mobile Web
Web | |
VKWebAppJoinGroup
Prompt the user to join the community. | Android
iOS
Mobile Web
Web | |
VKWebAppLeaveGroup
Prompt the user to leave the community. | Android
iOS
Mobile Web
Web |
Social mechanics and interaction
Event | Platforms | Features |
|---|---|---|
VKWebAppShare
Share a link. | Android
iOS
Mobile Web
Web | • In the web and mobile browser, only a wall post can be shared.
• On Android and iOS: on the wall, on a community wall, in a personal message, add text and send to the feed, send to an app or copy the link |
VKWebAppShowStoryBox
Open story editor. | Android
iOS
Mobile Web
Web | • For the background_type field, only the image value is supported.
• For blob, the JPEG, PNG and SVG values are supported.
• In the attachment object, the type parameter only supports the url value |
VKWebAppOpenWallPost
Open a wall post in the layer. | iOS
Mobile Web
Web |
If the post is published by the user, the user's ID must be indicated in owner_id. If the post is published in a community, the value should be 0 |
VKWebAppShowInviteBox
Invite friends to a game. | Android
iOS
Mobile Web
Web |
For games launched in the desktop or mobile OK website, the message message parameter must always be sent |
VKWebAppShowRequestBox
Send the user a request for help in a game. | iOS
Mobile Web
Web | |
VKWebAppAllowNotifications
Request permission to send notifications. | Android
iOS
Mobile Web
Web | |
VKWebAppDenyNotifications
Disable notifications. | Android
iOS
Mobile Web
Web |
Text and media
Event | Platforms | Features |
|---|---|---|
VKWebAppCopyText
Copy text to clipboard. | Android
iOS
Mobile Web
Web | |
VKWebAppDownloadFile
Download file to the device. | Android | |
VKWebAppOpenCodeReader
Read the QR code. | Android
iOS | |
VKWebAppShowImages
Open the native image viewer. | Android
iOS
Mobile Web | |
VKWebAppTranslate
Translate text to another language. | Android
iOS
Mobile Web
Web |
VK Storage
Event | Platforms | Features |
|---|---|---|
VKWebAppStorageSet
Create a "key — value" pair. | Android | |
VKWebAppStorageGet
Get the key value. | Android | |
VKWebAppStorageGetKeys
Get the names of all variables. | Android |
Authentication
Events of this group are only available for mini apps.
Event | Platforms | Features |
|---|---|---|
VKWebAppSecureTokenRequestAccess
Request user's permission to use their biometric data as an authentication method in the app. | iOS | |
VKWebAppSecureTokenSet
Save an arbitrary string in a secure storage to be used as an access token. | iOS | |
VKWebAppSecureTokenGet
Start the biometry check and obtain the access token from the secure storage after successful completion. | iOS | |
VKWebAppSecureTokenGetInfo
Get the information whether biometric check is available on the device. | iOS | |
VKWebAppSecureTokenRemove
Remove the access token saved for biometric user authentication from the secure storage. | iOS |
Mobile devices
Vibration feedback
Event | Platforms | Features |
|---|---|---|
VKWebAppTapticImpactOccurred
Call vibration upon impact. | iOS | |
VKWebAppTapticNotificationOccurred
Call vibration after action completion. | iOS | |
VKWebAppTapticSelectionChanged
Call vibration upon user selection change. | iOS |
Flashlight
Event | Platforms | Features |
|---|---|---|
VKWebAppFlashGetInfo
Get information about the flashlight. | Android
iOS | |
VKWebAppFlashSetLevel
Set flashlight brightness level. | Android
iOS |
Sensors
Event | Platforms | Features |
|---|---|---|
VKWebAppAccelerometerStart
Track accelerometer data. | Android
iOS | |
VKWebAppAccelerometerStop
Stop tracking accelerometer data. | Android
iOS | |
VKWebAppDeviceMotionStart
Track device positioning data. | Android
iOS | |
VKWebAppDeviceMotionStop
Stop tracking device positioning data. | Android
iOS | |
VKWebAppGyroscopeStart
Track gyroscope data. | Android
iOS | |
VKWebAppGyroscopeStop
Stop tracking gyroscope data. | Android
iOS |
See also
- •
- •