cordova-plugin-qqsdk
A Cordova wrapper around the Tencent QQ SDK for Android and iOS. Provides access to QQ ssoLogin, QQ Sharing, QQ Zone Sharing etc.. 简体中文.
Table of Contents
Feature
- QQ SSO Login
- QQ Logout
- QQ Share (Text、Image、News、Audio)
- QQZone Share(Text、Image、News、Audio)
- QQ Favorites(Text、Image、News、Audio)
- checkClientInstalled
Requirements
- Cordova Version 3.5+
- Cordova-Android >= 4.0
- Cordova-iOS >= 4.0
Installation
1.cordova plugin add cordova-plugin-qqsdk --variable QQ_APP_ID=YOUR_QQ_APPID
2. cordova build
Documentation
Support API
- ssoLogin
- Logout
- checkClientInstalled
- Share(see form below)
Platform | iOS | iOS | iOS | Android | Android | Android |
---|---|---|---|---|---|---|
ShareScene | QQZone | QQ Favorite | QQZone | QQ Favorite | ||
Text | √ | √ | √ | ✕ | √ | √ |
Image | √ | √ | √ | √ | √ | √ |
News | √ | √ | √ | √ | √ | √ |
Audio | √ | √ | √ | √ | √ | √ |
Error Code
When you use qq login,you may get an error code.If you get one, find detail error msg from here please.
Image
This plugin support three Image types:
- Network URL
- Base64
- Absolute file path
Usage
checkClientInstalled
var args = {};argsclient = QQSDKClientTypeQQ;//QQSDK.ClientType.QQ,QQSDK.ClientType.TIM;QQSDK;
ssoLogin
var args = {};argsclient = QQSDKClientTypeQQ;//QQSDK.ClientType.QQ,QQSDK.ClientType.TIM;QQSDK;
logout
QQSDK;
shareText
var args = {};argsclient = QQSDKClientTypeQQ;//QQSDK.ClientType.QQ,QQSDK.ClientType.TIM;argsscene = QQSDKSceneQQ;//QQSDK.Scene.QQZone,QQSDK.Scene.Favoriteargstext = '这个是 Cordova QQ 分享文字';QQSDK;
shareImage
var args = {};argsclient = QQSDKClientTypeQQ;//QQSDK.ClientType.QQ,QQSDK.ClientType.TIM;argsscene = QQSDKSceneQQ;//QQSDK.Scene.QQZone,QQSDK.Scene.Favoriteargstitle = '这个是 Cordova QQ 图片分享的标题';argsdescription = '这个是 Cordova QQ 图片分享的描述';argsimage = 'https://cordova.apache.org/static/img/cordova_bot.png';QQSDK;
shareNews
var args = {};argsclient = QQSDKClientTypeQQ;//QQSDK.ClientType.QQ,QQSDK.ClientType.TIM;argsscene = QQSDKSceneQQ;//QQSDK.Scene.QQZone,QQSDK.Scene.Favoriteargsurl = 'https://cordova.apache.org/';argstitle = '这个是 Cordova QQ 新闻分享的标题';argsdescription = '这个是 Cordova QQ 新闻分享的描述';argsimage = 'https://cordova.apache.org/static/img/cordova_bot.png';QQSDK;
shareAudio
var args = {};argsclient = QQSDKClientTypeQQ;//QQSDK.ClientType.QQ,QQSDK.ClientType.TIM;argsscene = QQSDKSceneQQ;//QQSDK.Scene.QQZone,QQSDK.Scene.Favoriteargsurl = 'https://y.qq.com/portal/song/001OyHbk2MSIi4.html';argstitle = '十年';argsdescription = '陈奕迅';argsimage = 'https://y.gtimg.cn/music/photo_new/T001R300x300M000003Nz2So3XXYek.jpg';argsflashUrl = 'http://stream20.qqmusic.qq.com/30577158.mp3';QQSDK;
getUserInfo
var url = 'https://graph.qq.com/user/get_user_info?access_token=' + accessToken + '&oauth_consumer_key=' + QQ_APP_ID + '&openid=' + userId;http
About SDK
This plugin use 3.2.1 version sdk for Android,3.2.3 version sdk for iOS. You can download lastest version sdk here
Notes
- This plugin is required Cordova-Android version >=4.0,so using Cordova 5.0 or higher is recommended
- This plugin should be used after the deviceready event has been fired!!!
If Cordova version <5.1.1,when two Cordova plugins are modifying “*-Info.plist” CFBundleURLTypes, only the first added plugin is getting the changes applied.so after installing plugin,please check the URLTypes in your Xcode project.You can find this issue hereUpdate:This Bug is fixed in last Cordova version(5.1.1)- For Android: make sure your signature is correct !!!
- long share URL and large image shoud be avoid.
Demo
- install this plugin
- backup www folder in your cordova project
- replace www by example_www
- install cordova-plugin-camera
- cordova build & test
Contributing
Feel free to contribute
License
cordova-plugin-qqsdk is released under the MIT license. See LICENSE file for more information.