Giter Site home page Giter Site logo

cordova-vk's Introduction

Cordova VK social network plugin

cordova/phonegap adapter for vksdk. iOS 9 compatible

You can use this plugin to authenticate user via VK application rather than via webview. It makes use of official VkSDKs for iOS and Android. This project is based on another github project https://github.com/DrMoriarty/cordova-social-vk . But Api was made a bit more generic to fit our needs.

Installation and Setup

First, you need to create VK application on developer page: https://vk.com/apps?act=manage

Android

cordova plugin add cordova-vk

Official VK documentation of how to setup and app is located here: https://vk.com/dev/android_sdk . Fill in Fill in the "Batch name for Android", "Main Activity for Android" and "Certificate fingerprint for Android" fields. To generate fingerprint once android app is installed and running you can use VkSdk.getFingerPrintVkSdk method like this: VkSdk.getFingerPrintVkSdk(function(fpt) { alert(fpt); });

iOS

cordova plugin add cordova-vk --variable VK_APP_ID=vk123456

Where vk123456 is unique identificator of your application, which you can see in your app settings: https://vk.com/editapp?id=123456 . Please note, that vk prefix should also be presented. This is needed to setup callback url scheme, so that VK application can open yours.

Sample usage

Upon your application startup you need to call VkSdk.init method with your APP id as an argument.

VkSdk.init('123456');

To initiate login process, you should call VkSdk.initiateLogin method:

VkSdk.initiateLogin(['photos', 'offline']);

As per SDKs' architecture receiving token is an event, rather than callback, you need to listen to vkSdk.newToken event to understand, when your user was logged in:

document.addEventListener('vkSdk.newToken', function(token) {
  console.log('New token is ' + token);
});

Important notes

Library is not complete. If you need bindings for some particular methods, create PRs or Issues. Thanks for your cooperation.

License

MIT

cordova-vk's People

Contributors

lugovsky avatar smartapant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-vk's Issues

How to add vksdk_library to the properties?

After installing plugin i get instuction to add
vksdk_library to the properties
I've got
android.library.reference.1=CordovaLib
android.library.reference.2=app

if i add
android.library.reference.3=vksdk_library
or
android.library.reference.2=vksdk_library

i have error
A problem occurred configuring project ':vksdk_library'.

Cannot read packageName from C:\games\cordova\gamename\platforms\android\vksdk_library\src\main\AndroidManifest.xml

I not vksdk is added i get nothing happens during vk init function, so i guess it is needed for working

Проблемы со сборкой на android.

При сборке ionic framework на android возникает проблема:

/**/platforms/android/src/com/akveo/cordovavk/cordovavk/SdkUtil.java:5: 
error: package com.vk.sdk does not exist
import com.vk.sdk.VKAccessToken;

Окружение:
node v6.9.1
cordova 6.1.1
ionic 1.7.16

want to help

This issue is related to our conversation with Anastasia. I want to participate in development flow but have no production expirience yet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.