Packageru.kavolorn.ane
Classpublic class VK
InheritanceVK Inheritance flash.events.EventDispatcher

Main library class for VK social network PRO Native Extension.

See also

VK platform for developers
PRO Native Extensions license server


Public Methods
 MethodDefined By
  
VK()
Constructs an extension.
VK
  
authorize(scope:Array, revoke:Boolean = false, forceOAuth:Boolean = false, isBasicAuthorization:Boolean = true):void
Starts authorization process manualy.
VK
  
execute(request:Object):void
Executes api request.
VK
  
getApiVersion():String
Gets underlying native SDK API version.
VK
  
getCertificateFingerprint():Vector.<String>
Gets certificates fingerprints for Android.
VK
  
[static] Gets the main instance to interact with.
VK
  
getSdkVersion():String
Gets underlying native SDK version.
VK
  
getUserToken():Object
Gets current user token.
VK
  
initialize(applicationId:String, licenseKey:String):void
Initializes extension.
VK
  
isSupported():Boolean
Reports if current platform is supported.
VK
  
logout():void
Logout user.
VK
  
setDebug(debug:Boolean = false):void
[static] Enables or disables debug output.
VK
  
share(request:Object):String
Shares user data with native dialog.
VK
Events
 Event Summary Defined By
   Dispatched after token has been accepted.VK
   Dispatched if initialization failed.VK
   Dispatched after successful initialization.VK
   Dispatched if new token is received.VK
   Dispatched if session is restored in initialization time.VK
   Dispatched if token has expired.VK
   Dispatched if used denied access.VK
Constructor Detail
VK()Constructor
public function VK()

Constructs an extension. Don't use it directly but use getInstance() instead.


Throws
Error — Context was not created successfully.
Method Detail
authorize()method
public function authorize(scope:Array, revoke:Boolean = false, forceOAuth:Boolean = false, isBasicAuthorization:Boolean = true):void

Starts authorization process manualy.

Parameters

scope:Array — array of values from VKScope
 
revoke:Boolean (default = false)
 
forceOAuth:Boolean (default = false)
 
isBasicAuthorization:Boolean (default = true)

execute()method 
public function execute(request:Object):void

Executes api request.

Request should contains method and parameters:

         {
             method: 'account.getAppPermissions',
             parameters: {}
         }

After request you can listen to success and error events:

         VK.getInstance().addEventListener("account.getAppPermissions", accountGetAppPermissionsHandler);
         VK.getInstance().addEventListener("account.getAppPermissions.error", accountGetAppPermissionsErrorHandler);

Parameters

request:Object — request object.

getApiVersion()method 
public function getApiVersion():String

Gets underlying native SDK API version.

Returns
String — api version string.
getCertificateFingerprint()method 
public function getCertificateFingerprint():Vector.<String>

Gets certificates fingerprints for Android.

Returns
Vector.<String> — certificate fingerprints if available or 'NOT_SUPPORTED' single item vector.
getInstance()method 
public static function getInstance():VK

Gets the main instance to interact with. Don't use constructor.

Returns
VK — extension instance.
getSdkVersion()method 
public function getSdkVersion():String

Gets underlying native SDK version.

Returns
String — sdk version string.
getUserToken()method 
public function getUserToken():Object

Gets current user token.

Returns
Object — user token.
initialize()method 
public function initialize(applicationId:String, licenseKey:String):void

Initializes extension. Should be called before extension can be used.

Parameters

applicationId:String — id obtained from VK application configuration.
 
licenseKey:String — key obtained from license server.

isSupported()method 
public function isSupported():Boolean

Reports if current platform is supported.

Returns
Boolean — is platform supported or not.
logout()method 
public function logout():void

Logout user.

setDebug()method 
public static function setDebug(debug:Boolean = false):void

Enables or disables debug output.

Parameters

debug:Boolean (default = false) — flag which enables debug output.

share()method 
public function share(request:Object):String

Shares user data with native dialog.

Request contains the following parameters:

         {
             text : "This is a super resource with professional Adobe AIR native extensions.",
             link : {
                 text : "PRO Native Extensions",
                 url : "http://kavolorn.ru/pro-native-extensions"
             },
             photos : [
                 "photo-30022666_375485324"
             ],
             complete : function(postId:String) {
                 trace("Sharing completed. Post id " + postId + ".");
             },
             cancel : function() {
                 trace("Sharing was canceled.");
             }
         }

Parameters

request:Object — request object.

Returns
String
Event Detail
acceptedUserToken Event
Event Object Type: ru.kavolorn.ane.VKEvent
VKEvent.type property = ru.kavolorn.ane.VKEvent.ACCEPTED_USER_TOKEN

Dispatched after token has been accepted.
initializationError Event  
Event Object Type: ru.kavolorn.ane.VKEvent
VKEvent.type property = ru.kavolorn.ane.VKEvent.INITIALIZATION_ERROR

Dispatched if initialization failed.
initializationSuccess Event  
Event Object Type: ru.kavolorn.ane.VKEvent
VKEvent.type property = ru.kavolorn.ane.VKEvent.INITIALIZATION_SUCCESS

Dispatched after successful initialization.
receivedNewToken Event  
Event Object Type: ru.kavolorn.ane.VKEvent
VKEvent.type property = ru.kavolorn.ane.VKEvent.RECEIVED_NEW_TOKEN

Dispatched if new token is received.
sessionWakedUp Event  
Event Object Type: ru.kavolorn.ane.VKEvent
VKEvent.type property = ru.kavolorn.ane.VKEvent.SESSION_WAKED_UP

Dispatched if session is restored in initialization time.
tokenHasExpired Event  
Event Object Type: ru.kavolorn.ane.VKEvent
VKEvent.type property = ru.kavolorn.ane.VKEvent.TOKEN_HAS_EXPIRED

Dispatched if token has expired.
userDeniedAccess Event  
Event Object Type: ru.kavolorn.ane.VKEvent
VKEvent.type property = ru.kavolorn.ane.VKEvent.USER_DENIED_ACCESS

Dispatched if used denied access.