This is a Cordova Plugin for QQ SDK . 简体中文.
I also write a cordova plugin for WeiboSDK here.
- QQ SSO Login
- QQ Logout
- QQ Share
- QZone Share
- QQ Favorites
- checkClientInstalled
- Cordova Version 3.5+
- Cordova-Android >=4.0
##Installation
cordova plugin add https://github.com/coolhihi/Cordova_QQ.git --variable QQ_APP_ID=YOUR_QQ_APPID
orcordova plugin add cordova-plugin-qqsdk --variable QQ_APP_ID=YOUR_QQ_APPID
- cordova build
##Notes
you may get a error like this "platforms/android/libs/android-support-v4.jar" already exists!",because you may have duplicate android-support-v4.jar files in your android project. Remove android-support-v4.jar from the /libs folder of your project.fixed by hook- This plugin is required cordova-android version >=4.0,so using cordova 5.0.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 !!!
###App Transport Security iOS 9 introduces a new security feature that blocks non-HTTPS traffic in your app. However, Tencent QQ SDK not support HTTPS yet, this Plugin will turn off https and allow non-HTTPS traffic
##Usage
var checkClientIsInstalled = 1;//default is 0,only for iOS
YCQQ.ssoLogin(function(args){
alert(args.access_token);
alert(args.userid);
},function(failReason){
console.log(failReason);
},checkClientIsInstalled);
YCQQ.logout(function(){
console.log('logout success');
},function(failReason){
console.log(failReason);
});
var args = {};
args.url = "";
args.title = "";
args.description = "";
args.imageUrl = "";
args.appName = "";
YCQQ.shareToQQ(function(){
console.log("share success");
},function(failReason){
console.log(failReason);
},args);
var args = {};
args.url = "http://www.baidu.com";
args.title = "This is cordova QZone share ";
args.description = "This is cordova QZone share ";
var imgs =['https://www.baidu.com/img/bdlogo.png',
'https://www.baidu.com/img/bdlogo.png',
'https://www.baidu.com/img/bdlogo.png'];
args.imageUrl = imgs;
YCQQ.shareToQzone(function () {
alert("share success");
}, function (failReason) {
alert(failReason);
}, args);
###QQ Favorites
var args = {};
args.url = "http://www.baidu.com";
args.title = "这个是cordova QQ 收藏测试";
args.description = "这个是cordova QQ 收藏测试";
args.imageUrl = "https://www.baidu.com/img/bdlogo.png";
args.appName = "cordova—QQ";
YCQQ.addToQQFavorites(function () {
alert("share success");
}, function (failReason) {
alert(failReason);
}, args);
YCQQ.checkClientInstalled(function(){
console.log('client is installed');
},function(){
// if installed QQ Client version is not supported sso,also will get this error
console.log('client is not installed');
});
##Example
- install this plugin
- backup www folder in your cordova project
- replace www by example_www
- cordova build & test
##ERROR_CODE When you use qq login,you may get an error code.If you get one, find detail error msg from here please.