Skip to content
A VKontakte NativeScript module for Android and iOS
JavaScript Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
platforms
.npmignore
LICENSE
README.md
index.android.js
index.d.ts
index.ios.js
package.json
publish.bat

README.md

nativescript-vkontakte

A VKontakte NativeScript module for Android and iOS

install npm package

tns plugin add nativescript-vkontakte

Setup

Android

Initialize inside application onCreate (extend application doc)

var vk = require("nativescript-vkontakte");
    ...
    onCreate: function() 
    {
        superProto.onCreate.call(this);
        // Enter custom initialization code here
        var context = this.getApplicationContext();
        vk.initialize(context);
    },

Subscribe on activityResult

import * as application from "application";
import * as vk from "nativescript-vkontakte";

application.android.on('activityResult', data => 
{
    let res = vk.onActivityResult(data.requestCode, data.resultCode, data.intent, token => 
    {
        console.log('VKCallback userId: ' + token.userId);
    }, error => 
    {
        console.log('VKCallback error: ' + error.errorCode);
    });
    console.log('onActivityResult ' + res.toString());
});

Add AppID to strings.xml

<integer name="com_vk_sdk_AppId">YOUR_APP_ID</integer>

iOS

Add AppID to Info.plist

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLName</key>
        <string>vkYOUR_APP_ID</string>
    </dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>vk</string>
    <string>vk-share</string>
    <string>vkauthorize</string>
</array>

Links:

You can’t perform that action at this time.