4 Star 5 Fork 0

mosandisk / cordova-plugin-qq

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Cordova_QQ_插件

version platform GitHub license Contact

这个一个QQ SDK的Cordova 插件。 English 如果你希望使用一个微博的cordova插件可以查看这里. ##主要功能

  • QQ 登录
  • QQ 登出
  • QQ 分享
  • QQ 空间分享
  • QQ 收藏
  • 检查 QQ 手机客户端端是否安装

##安装要求

  • Cordova Version >=3.5
  • Cordova-Android >=4.0
  • Cordova-iOS >=4.0

##安装

  1. 命令行运行 cordova plugin add https://git.oschina.net/modisk/cordova-plugin-qq.git --variable QQ_APP_ID=YOUR_QQ_APPID 或者 cordova plugin add cordova-plugin-qqsdk --variable QQ_APP_ID=YOUR_QQ_APPID
  2. 命令行运行 cordova build --device

##注意事项 请认真阅读文档,请认真阅读文档,请认真阅读文档

  1. 这个插件要求cordova-android 的版本 >=4.0,推荐使用 cordova 5.0.0 或更高的版本,因为从cordova 5.0 开始cordova-android 4.0 是默认使用的android版本
  2. 请在cordova的deviceready事件触发以后再调用本插件!!!
  3. 在低于5.1.1的cordova版本中存在一个Bug,如果你有多个插件要修改iOS工程中的 “*-Info.plist” CFBundleURLTypes, 只有第一个安装的插件才会生效.所以安装完插件请务必在你的Xcode工程里面检查一下URLTypes。 关于这个bug的详情你可以在 这里找到 建议安装使用5.1.1及以上的cordova版本
  4. Android版本请确保你的签名是正确的

##使用方式

QQ SSO 登录

var checkClientIsInstalled = 1;//默认值是 0,仅仅针对 iOS平台有效![]()
YCQQ.ssoLogin(function(args){
      alert("token is " + args.access_token);
      alert("userid is " +args.userid);
      alert("expires_time is "+ new Date(parseInt(args.expires_time)) + " TimeStamp is " +args.expires_time);
      },function(failReason){
         console.log(failReason);
},checkClientIsInstalled);

QQ 登出

YCQQ.logout(function(){
	console.log('logout success');
},function(failReason){
	console.log(failReason);
});

QQ 分享

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);

QQ空间分享

 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 收藏

 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);

检查QQ客户端是否安装了

YCQQ.checkClientInstalled(function(){
	console.log('client is installed');
},function(){
	// 如果安装的QQ客户端版本太低,不支持SSO登录也会返回没有安装客户端的错误
	console.log('client is not installed');
});

#测试Demo 在安装完这个插件以后,把 cordova 工程中的代码替换为 example_www中的代码,在build以后可以进行各个功能测试,以下为运行效果图:

example
#错误码 使用SDK时,所有结果都会通过回调返回给应用。在回调的结果中,会包含每次调用结果的返回码。 正常情况下返回码为0,表示调用成功。 如果返回码不为0,说明调用出错,需要根据返回码的值来定位错误原因。 110201:未登陆 110405:登录请求被限制 110404:请求参数缺少appid 110401:请求的应用不存在 110407:应用已经下架 110406:应用没有通过审核 100044:错误的sign 110500:获取用户授权信息失败 110501:获取应用的授权信息失败 110502:设置用户授权失败 110503:获取token失败 110504:系统内部错误

详情查看这里

The MIT License (MIT) Copyright (c) 2015 Van Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

这个一个QQ SDK的Cordova 插件 展开 收起
JavaScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/modisk/cordova-plugin-qq.git
git@gitee.com:modisk/cordova-plugin-qq.git
modisk
cordova-plugin-qq
cordova-plugin-qq
master

搜索帮助

14c37bed 8189591 565d56ea 8189591