ShareSDK接入说明文档
sdk接入流程标准

sdk接入流程标准下载温馨提示:该文档是我店铺精心编制而成,希望大家下载以后,能够帮助大家解决实际的问题。
文档下载后可定制随意修改,请根据实际需要进行相应的调整和使用,谢谢!并且,本店铺为大家提供各种各样类型的实用资料,如教育随笔、日记赏析、句子摘抄、古诗大全、经典美文、话题作文、工作总结、词语解析、文案摘录、其他资料等等,如想了解不同资料格式和写法,敬请关注!Download tips: This document is carefully compiled by theeditor. I hope that after you download them,they can help yousolve practical problems. The document can be customized andmodified after downloading,please adjust and use it according toactual needs, thank you!In addition, our shop provides you with various types ofpractical materials,such as educational essays, diaryappreciation,sentence excerpts,ancient poems,classic articles,topic composition,work summary,word parsing,copy excerpts,other materials and so on,want to know different data formats andwriting methods,please pay attention!1. 需求分析确定需要接入的 SDK 功能和目标。
了解 SDK 的技术要求和限制。
客户端SDK使用手册

DS_8000HC系列网络硬盘录像机客户端软件开发包编程手册版本1.4(Build 050708)2005-07-08前言非常感谢您使用我们公司的设备,我们将为您提供最好的服务。
本手册可能包含技术上不准确的地方或印刷错误。
本手册的内容将做定期的更新,恕不另行通知;更新的内容将会在本手册的新版本中加入。
我们随时会改进或更新本手册中描述的产品或程序。
目录第一章简介 (5)1.1 组成 (5)1.2 注意事项 (5)第二章编程指南 (7)2.1 编程说明 (7)2.2 函数调用顺序 (8)第三章数据结构 (11)3.1 客户端数据结构 (11)3.1.1 显示模式 (11)3.1.2 发送模式 (11)3.1.3设备信息结构 (11)3.1.4 图像预览参数 (11)3.1.5 文件信息结构 (12)3.1.6 上传的报警信息 (12)3.1.7 报警输出状态 (13)3.1.8 硬件解码预览图像参数 (13)3.1.9 日志信息 (13)3.1.10 设备的状态信息 (15)3.1.11 ATM DVR上传交易信息 (16)3.2 设备端参数数据结构 (16)3.2.1 设备系统配置结构 (17)3.2.2 网络配置结构 (17)3.2.3 通道图像配置结构 (18)3.2.4 压缩参数配置结构 (21)3.2.5 录像配置参数结构 (21)3.2.6 解码器参数配置结构 (22)3.2.7 串口配置结构 (24)3.2.8 报警输入配置结构 (24)3.2.9 报警输出配置结构 (25)3.2.10 本地预览参数配置结构 (25)3.2.11 视频输出配置结构 (25)3.2.12 用户参数配置结构 (26)3.2.13 异常参数配置结构 (27)3.2.14 帧信息配置结构 (27)第四章函数说明 (28)4.1 客户端函数 (28)4.1.1 初始化 (28)4.1.2 设置显示模式 (31)4.1.3 启动/停止监听程序 (31)4.1.4 获取错误代码 (31)4.1.5 用户注册 (33)4.1.6 图像预览 (33)4.1.6.1 视频参数 (34)4.1.6.2 叠加字符和图像 (34)4.1.6.3 播放控制 (35)4.1.6.4 声音控制 (35)4.1.6.5 捕获 (36)4.1.6.6 抓图 (37)4.1.7 云台控制 (37)4.1.8 回放与下载 (40)4.1.8.1 查找文件 (40)4.1.8.2 回放 (41)4.1.8.3 播放控制 (42)4.1.8.4 捕获 (42)4.1.8.5 获取OSD时间 (43)4.1.8.6 抓图 (44)4.1.8.7 下载 (44)4.1.9 报警 (45)4.1.10 语音对讲 (45)4.1.11 语音广播 (46)4.1.12 透明通道 (46)4.1.13 远程控制本地显示 (47)4.1.14 远程手动录像 (48)4.1.15 解码卡 (48)4.1.16 日志 (50)4.1.17 获取设备状态 (50)4.2 设备端配置函数 (51)4.2.1 参数配置 (51)4.2.2 恢复默认值 (53)4.2.3 保存参数 (53)4.2.4 重启/关闭设备 (53)4.2.5 远程升级 (53)4.2.6 远程格式化硬盘 (54)4.2.7 配置交易信息 (55)第一章简介1.1 组成客户端软件开发包是DS_8000HC系列网络硬盘录像机、DS_6000HC系列网络视频服务器的配套产品,本手册详细介绍了此软件开发包中各个函数所实现的功能以及使用方法、各个函数之间的调用关系。
iOS开发:如何使用ShareSDK让APP快速拥有分享功能

其中第一个参数为平台类型, 用于指定获取哪个平台的授权用户信息。 如果指定平台的用户尚未进行授权则弹 出授权界面。第二个参数为授权返回的处理方法。
9. 关注用户 关注指定用户(此接口目前仅支持新浪微博和腾讯微博),其调用方式如下:
[ShareSDK followUserWithName:@"ShareSDK" shareType:ShareTypeSinaWeibo result:^(BOOL result, id<ISSUserInfo> userInfo, id<ICMErrorInfo> error) { if (result) { NSLog(@"成功"); } else { NSLog(@"失败"); } }];
菜单分享视图
编辑分享内容视图
7.2 分享内容视图方式 使用此方式直接弹出内容分享编辑框,用户编辑完内容后点击发布直接分享出去。其调用代码如下:
[ShareSDK shareContentWithType:ShareTypeSinaWeibo content:[ShareSDK publishContent: @"content" defaultContent:@"" image:[UIImage imageNamed: @"Icon.png"] imageQuality:0.8 mediaType:SSPublishContentMediaTypeText] containerController:self statusBarTips:YES oneKeyShareList:[NSArray defaultOneKeyShareList]
其中第一个参数为分享的目标平台类型数组,使用 ShareSDK 的 getShareListWithType 方法进行数组列
sdk接入标准及流程规范

sdk接入标准及流程规范Software development kits (SDKs) play a crucial role in enabling developers to easily integrate third-party services and functionalities into their applications. SDKs serve as a bridge between the developer's code and the external service they wish to utilize, simplifying the integration process and reducing the time and effort required to incorporate complex functionalities. SDK接入标准及流程规范对于开发过程的顺利进行至关重要,它为开发人员提供了快速,便捷的方式将第三方服务和功能集成到他们的应用程序中。
When it comes to integrating an SDK into an application, it is essential to follow standardized processes and guidelines to ensure compatibility and seamless operation. Each SDK typically comes with documentation that outlines the integration steps, requirements, and best practices. Developers should carefully review this documentation to understand the necessary steps and configurations needed to successfully incorporate the SDK into their application. 在将SDK集成到应用程序中时,遵循标准化的流程和准则是至关重要的,以确保兼容性和无缝运行。
使用ShareSDK实现用户第三方登录-IOS

//登录成功 //显示注销按钮 self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"注销 "
style:UIBarButtonItemStyleBordered target:self action:@selector(logoutButtonClickHandler:)] 13
9
官方文档
打开*AppDelegate.m(*代表你的工程名字) 导入文件头 ShareSDK.h:
#import <ShareSDK/ShareSDK.h>
在- (BOOL)application: didFinishLaunchingWithOptions:方法中添加如下语 句对 ShareSDK 和 Parse 进行初始化。
将取到的用户信息与服务器中本地帐号信息进行关联。 4、 登录应用主界面。 5、在注销登录时可以使用 ShareSDK 中的 cancelAuthWithType 方法来实现。如果
需要重新登录跳转回步骤 1 重新执行。 下面将使用一个简单的例子,对这个过程进行阐述。在这个例子中我们不单 独设计服务器端,采用国外的数据存储服务 Parse 来进行对帐号的存储和验证。 然后客户端只集成新浪微博平台,并使用该平台实现第三方登录。
action:@selector(loginButtonClickHandler:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:loginButton]; }
运行效果如下:
sdk接入流程

sdk接入流程SDK接入流程。
一、概述。
SDK(Software Development Kit)是软件开发工具包的缩写,是一套开发工具的集合,用于实现特定软件应用程序的开发。
在移动应用开发中,SDK的接入是非常重要的一环,它可以为开发者提供丰富的功能和服务,帮助开发者更快地完成应用的开发和发布。
二、准备工作。
在进行SDK接入之前,开发者需要做好一些准备工作,包括:1. 确定需求,明确自己的应用需要哪些功能和服务,选择合适的SDK进行接入。
2. 获取SDK,从官方渠道获取最新版本的SDK,并阅读相关文档和说明。
3. 确定平台和版本,确定要接入的平台和版本,例如Android、iOS等,以及对应的版本号。
4. 确认权限,确认应用需要的权限和对应的申请流程,保证应用在接入SDK时能够正常运行。
三、SDK接入流程。
1. 导入SDK,将下载好的SDK导入到开发环境中,例如Android Studio、Xcode等。
2. 配置参数,根据SDK提供的文档,配置相应的参数,例如应用ID、密钥、回调URL等。
3. 添加依赖,在项目中添加SDK的依赖,确保应用能够正常调用SDK提供的功能和服务。
4. 初始化SDK,在应用启动时,初始化SDK,进行必要的设置和初始化操作。
5. 调用接口,根据SDK提供的接口文档,调用相应的接口实现功能,例如登录、支付、分享等。
6. 处理回调,处理SDK回调,处理用户的操作结果或者错误信息,保证应用的正常运行。
7. 测试调试,在接入SDK后,进行测试调试,确保应用在不同环境下能够正常使用SDK提供的功能。
四、注意事项。
在进行SDK接入的过程中,开发者需要注意以下事项:1. 遵循官方文档,严格按照SDK官方提供的文档和规范进行接入,确保接入的正确性和稳定性。
2. 版本更新,定期关注SDK的版本更新,及时更新应用中使用的SDK版本,以获取最新的功能和修复已知的问题。
3. 权限申请,在应用中使用SDK时,需要向用户申请相应的权限,确保用户的隐私和数据安全。
闲聊sdk接入说明.docx

闲聊SDK接入以下是游戏需求(Ctrl点击进入超链接):游戏场景图需求补充:游戏头像以及昵称按照最先点击登录的类型处理,即先点击哪种登录方式,就以该种登录方式显示。
以下是闲聊给出的文档:闲聊安卓开发文档闲聊IOS开发文档闲聊server开发文档以下是闲聊给出的demo(在开发过程中闲聊有更换sdk,所以他们的demo仅做参考):安卓_demoIOS_demo以下是河南麻将项目接入文档(并未完全按照闲聊所给文档接入):一、安卓篇1.在Eclipse内导入sugramsdk.jar。
2.在android项目内添加SGEntryActivity.java(位置为:henmj\android\src\com\happyplay\hn mj\sgapi)3.在android项目内添加MyHttpClient.java、SSLSocketFactoryEx.java、XianLiaoActivity.java三个文件(位置为:henmj\android\src\org\cocos2dx\javascript)4.在android项目内修改AppActivity.java1).添加以下内容//xianliaoimport org.sugram.im.sdk.api.ISGAPI;import org.sugram.im.sdk.api.SGAPIFactory;import org.sugram.im.sdk.constants.SGConstants;import org.sugram.im.sdk.modelmsg.SGGameObject;import org.sugram.im.sdk.modelmsg.SGImageObject;import org.sugram.im.sdk.modelmsg.SGMediaMessage;import org.sugram.im.sdk.modelmsg.SGTextObject;import org.sugram.im.sdk.modelmsg.SendMessageToSG;2).在AppActivity里添加public class AppActivity extends Cocos2dxActivity {......// xianliaopublic ISGAPI sgApi;public static String XL_AppID = "xxxxxxxxxx闲聊审核获得xxxxxxxxxx";public static String XL_AppSecret = "xxxxxxxx闲聊审核获得xxxxxxxxxx";public String xlInviteGameInfo = "";......}3).在onCreate函数内添加public void onCreate(Bundle savedInstanceState) {......xianLiaoInit();//get intent data from XianLiaoActivityBundle bundle = getIntent().getExtras();if(bundle != null){String msg =bundle.getString("XL_InviteGameInfo");xlInviteGameInfo = msg;Log.i("getIntent","getIntent_XL_InviteGameInfo:"+msg);}......try {......this.writeFileData("xianliao.txt", "has xianliao");} catch (IOException e) {......}......}4).添加函数RunJS_obj//param是{} 对象的public void RunJS_obj(String name, String param){Cocos2dxHelper.runOnGLThread((new Runnable() {String js;String para;@Overridepublic void run() {// TODO Auto-generated method stubString command = "cc.eventManager.dispatchCustomEvent('" + js + "'," + para + ")";org.cocos2dx.lib.Cocos2dxJavascriptJavaBridge.evalString(command);}public Runnable setjs(String js, String pa) {this.js = js;this.para = pa;return this;}}).setjs(name, param));}5)..添加函数xianLiaoInitpublic void xianLiaoInit() {// 通过SGAPIFactory 工厂,获取ISGAPI 实例sgApi = SGAPIFactory.createSGAPI(this, XL_AppID);sgApi.registerApp(XL_AppID);}6).修改微信登录函数wxLogin把SendAuth.Req req = new SendAuth.Req(); 改为com.tencent.mm.sdk.modelm sg.SendAuth.Req req = new com.tencent.mm.sdk.modelmsg.SendAuth.Req();7).添加函数xianLiaoLoginpublic void xianLiaoLogin() {if(isXLInstall()){org.sugram.im.sdk.modelmsg.SendAuth.Req req = new org.sugram.im.sdk. modelmsg.SendAuth.Req();req.state = "none";sgApi.sendReq(req);}}8).添加函数isXLInstall//判断闲聊是否安装public boolean isXLInstall(){boolean haveXL = sgApi.isSGAppInstalled();if(haveXL){return true;}else{doWithoutXLApp();return false;}}9).添加函数doWithoutXLApp//have no xl apppublic void doWithoutXLApp(){Log.i("xianliao","doWithoutXLApp");Intent viewIntent = new Intent("android.intent.action.VIEW",Uri.parse("/o/simple.jsp?pkgname=org.xianliao"));startActivity(viewIntent);}10).添加函数xlShareTextpublic void xlShareText(String text) {if(isXLInstall()){// 初始化一个SGTextObject 对象,填写分享的文本内容SGTextObject textObject = new SGTextObject();textObject.text = text;// 用SGTextObject 对象初始化一个SGMediaMessage 对象SGMediaMessage msg = new SGMediaMessage();msg.mediaObject = textObject;// 构造一个ReqSendMessageToSG.Req req = new SendMessageToSG.Req();req.transaction = SGConstants.T_TEXT;// 分享文本req.mediaMessage = msg;req.scene = SendMessageToSG.Req.SGSceneSession; // 代表分享到会话列表// 调用api 接口发送数据到闲聊sgApi.sendReq(req);}}11).添加函数xlShareInviteGamepublic void xlShareInviteGame(String roomId, String roomToken,String title, String description) {if(isXLInstall()){Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.icon);// 初始化一个SGGameObject 对象,设置所分享的游戏图片内容SGGameObject gameObject = new SGGameObject(bitmap);gameObject.roomId = roomId;gameObject.roomToken = roomToken;// 用SGGameObject 对象初始化一个SGMediaMessage 对象SGMediaMessage msg = new SGMediaMessage();msg.mediaObject = gameObject;msg.title = title;msg.description = description;// 构造一个ReqSendMessageToSG.Req req = new SendMessageToSG.Req();req.transaction = SGConstants.T_GAME;req.mediaMessage = msg;req.scene = SendMessageToSG.Req.SGSceneSession; // 代表分享到会话列表// 调用api 接口发送数据到闲聊sgApi.sendReq(req);}}12).添加函数xlShareTexturepublic void xlShareTexture(String path) {if(isXLInstall()){Bitmap bitmap = BitmapFactory.decodeFile(path);// 初始化一个SGImageObject对象,设置所分享的图片内容SGImageObject imageObject = new SGImageObject(Bitmap.createScaledBitmap(bitmap,1000,(int) (bitmap.getHeight() / (bitmap.getWidth() / 1000f)),true));// 用SGImageObject对象初始化一个SGMediaMessage对象SGMediaMessage msg = new SGMediaMessage();msg.mediaObject = imageObject;// 构造一个ReqSendMessageToSG.Req req = new SendMessageToSG.Req();req.transaction = SGConstants.T_IMAGE;req.mediaMessage = msg;req.scene = SendMessageToSG.Req.SGSceneSession; // 代表分享到会话列表// 调用api接口发送数据到SugramsgApi.sendReq(req);}}13).添加函数GetXLInviteGameInfopublic void GetXLInviteGameInfo(){String rtn_msg = xlInviteGameInfo;if(rtn_msg != ""){RunJS_obj("XL_InviteGameInfo",rtn_msg);}xlInviteGameInfo = "";}14).添加函数StartXianLiaoLoginpublic static void StartXianLiaoLogin() {if (ccActivity != null) {ccActivity.xianLiaoLogin();}}15).添加函数StartShareTextToXLpublic static void StartShareTextToXL(String path) {if (ccActivity != null) {ccActivity.xlShareText(path);}}16).添加函数StartShareInviteGameToXLpublic static void StartShareInviteGameToXL(String roomId,String roomToken, String title, String description) {if (ccActivity != null) {ccActivity.xlShareInviteGame(roomId, roomToken, title, description);}}17).添加函数StartShareTextureToXLpublic static void StartShareTextureToXL(String path) {if (ccActivity != null) {ccActivity.xlShareTexture(path);}}18).添加函数xlGetInviteGameInfopublic static void xlGetInviteGameInfo(){if (ccActivity != null) {ccActivity.GetXLInviteGameInfo();}}19).在AndroidManifest.xml中添加<!-- xianliao --><activity android:name="org.cocos2dx.javascript.XianLiaoActivity"android:screenOrientation="sensorLandscape"android:configChanges="orientation"android:theme="@android:style/Theme.NoTitleBar.Fullscreen"><intent-filter><action android:name="android.intent.action.VIEW" /><category android:name="android.intent.category.DEFAULT"/><category android:name="android.intent.category.BROWSABLE"/><data android:scheme="paraches"android:host="xianliao*******闲聊审核获得的APPID*****"/></intent-filter></activity><activityandroid:name="com.happyplay.hnmj.sgapi.SGEntryActivity"android:exported="true"></activity>二、JS篇1.在app.js中修改函数jsclient.logout,在函数中添加以下内容jsclient.logout = function () {if (jsclient.remoteCfg.httpLogin) {sys.localStorage.removeItem("WX_USER_LOGIN");sys.localStorage.removeItem("XL_USER_LOGIN");sys.localStorage.removeItem("LoginType");sys.localStorage.removeItem("loginData");sendEvent("logout");}else {jsclient.block();jsclient.gamenet.request("pkcon.handler.logout", {},function () {sys.localStorage.removeItem("WX_USER_LOGIN");sys.localStorage.removeItem("XL_USER_LOGIN");sys.localStorage.removeItem("LoginType");sys.localStorage.removeItem("loginData");sendEvent("logout");jsclient.unblock();});}};2.在app.js中添加函数getWXunionidjsclient.getWXunionid = function () {var unionid = "";var WX_USER_LOGIN = sys.localStorage.getItem("WX_USER_LOGIN");if(WX_USER_LOGIN){WX_USER_LOGIN = JSON.parse(WX_USER_LOGIN);unionid = WX_USER_LOGIN.unionid;}return unionid;};3.在app.js中添加函数operateFirstLoginTypejsclient.operateFirstLoginType = function (type) {if(!type){var loginType = sys.localStorage.getItem("LoginType");if(loginType){return loginType;}}else {if(type) {sys.localStorage.setItem("LoginType", type);return type;}elsereturn null;}};4.在app.js中添加函数doInviteGameInfojsclient.doInviteGameInfo = function (para) {if(!para){return;}//玩家还未登陆if (jsclient.loginui) {jsclient.showMsgDelay(0.2,"请先登陆游戏后再次点击游戏约局信息!");}//玩家已经登录-未在房间内else if (!jsclient.data.sData) {jsclient.joinGame(para.roomId, para.roomToken.gameType);}//玩家已经登录-在房间内else if (jsclient.data.sData) {var sData = jsclient.data.sData;var tData = sData.tData;var xl_type = para.roomToken.gameType;var xl_roomid = para.roomId;var pp_type = sData.gameid;var pp_roomid = tData.tableid;if(xl_type!=pp_type || xl_roomid!=pp_roomid){jsclient.showMsgDelay(0.2, "您现在已经在游戏中,请先退出当前房间后再次点击游戏约局信息!");}}};5.在app.js中添加函数xlCheckAndSharejsclient.xlCheckAndShare = function () {//检查是否进行过闲聊授权(此处为第二处可以关联微信、闲聊、皮皮账号的地方),如果没有就进行闲聊授权登录var XL_USER_LOGIN = sys.localStorage.getItem("XL_USER_LOGIN");if(!XL_USER_LOGIN){if (jsclient.native)jsclient.native.xlLogin();return;}//进行函数调用if(jsclient.xianLiaoPara){var para = jsclient.xianLiaoPara;if(para.type == XianLiaoType.text){ //文本var text = para.text;jsclient.native.xlShareText(text);}else if(para.type == XianLiaoType.image){ //图片jsclient.native.xlShareImage();}else { //游戏邀请var roomId = para.roomId;var roomToken = para.roomToken;var title = para.title;var description = para.description;jsclient.native.xlInviteGame(roomId,roomToken,title,description);}}};6.在app.js中添加函数showMsgDelayjsclient.showMsgDelay = function (delay, msg, yesfunc, nofunc, style) {if (jsclient.Scene) {jsclient.Scene.scheduleOnce(function () {jsclient.showMsg(msg, yesfunc, nofunc, style);},delay);}};7.在app.js中的CallBack中的initSceneData消息中添加xlGetInviteGameInfo的函数调用initSceneData: [0, function (d) {......if (d.tData.roundNum <= -2) {......}else {......jsclient.native.xlGetInviteGameInfo();}}],8.在app.js中的JSScene的jsBind中的loginOK消息中添加xlGetInviteGameInfo的函数调用loginOK: function (rtn) {......if (rtn.vipTable > 0) {......}else {......jsclient.native.xlGetInviteGameInfo();}},9.在app.js中的JSScene的jsBind中添加XL_InviteGameInfo消息XL_InviteGameInfo: function (para) {jsclient.doInviteGameInfo(para);},10.在app.js中的jsclient.native中添加xlLogin函数xlLogin: function () {try {if (cc.sys.OS_ANDROID == cc.sys.os) {jsb.reflection.callStaticMethod("org.cocos2dx.javascript.AppActivity", "StartX ianLiaoLogin", "()V");}else if (cc.sys.OS_IOS == cc.sys.os) {jsb.reflection.callStaticMethod("AppController", "sendXLRequest");}} catch (e) {jsclient.native.HelloOC("xianLiaoLogin throw: " + JSON.stringify(e));}},11.在app.js中的jsclient.native中添加xlInviteGame函数xlInviteGame:function (roomId,roomToken,title,description) {try {if (cc.sys.OS_ANDROID == cc.sys.os) {jsb.reflection.callStaticMethod("org.cocos2dx.javascript.AppActivity","StartShareInviteGameToXL","(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;) V",roomId, roomToken, title, description);}else if (cc.sys.OS_IOS == cc.sys.os) {jsb.reflection.callStaticMethod("AppController","xlShareInvite:AndID:AndTitle:AndText:",roomToken,roomId,title,description);}} catch (e) {jsclient.native.HelloOC("XLInviteGame throw: " + JSON.stringify(e));}},12.在app.js中的jsclient.native中添加xlShareImage函数xlShareImage:function () {try {var writePath = jsb.fileUtils.getWritablePath();var textrueName = "wxcapture_screen.png";if (cc.sys.OS_ANDROID == cc.sys.os) {jsb.reflection.callStaticMethod("org.cocos2dx.javascript.AppActivity","StartShareTextureToXL","(Ljava/lang/String;)V",writePath + textrueName);}else if (cc.sys.OS_IOS == cc.sys.os) {var writePath = jsb.fileUtils.getWritablePath();var textrueName = "wxcapture_screen.png";jsb.reflection.callStaticMethod("AppController","xlShareImage:",writePath + textrueName);}} catch (e) {jsclient.native.HelloOC("XLShareImage throw: " + JSON.stringify(e));}},13.在app.js中的jsclient.native中添加xlShareText函数xlShareText:function (text) {try {if (cc.sys.OS_ANDROID == cc.sys.os) {jsb.reflection.callStaticMethod("org.cocos2dx.javascript.AppActivity","StartShareTextToXL","(Ljava/lang/String;)V",text);}else if (cc.sys.OS_IOS == cc.sys.os) {jsb.reflection.callStaticMethod("AppController","xlShareText:AndText:","【四方河南麻将】",text);}} catch (e) {jsclient.native.HelloOC("xlShareText throw: " + JSON.stringify(e));}},14.在app.js中的jsclient.native中添加xlGetInviteGameInfo函数xlGetInviteGameInfo:function () {......try {if (cc.sys.OS_ANDROID == cc.sys.os) {jsb.reflection.callStaticMethod("org.cocos2dx.javascript.AppActivity", "xlGetI nviteGameInfo", "()V");}else if (cc.sys.OS_IOS == cc.sys.os) {jsb.reflection.callStaticMethod("AppController", "xlGetInviteGameInfo");}} catch (e) {jsclient.native.HelloOC("xlGetInviteGameInfo throw: " + JSON.stringify(e));}},15.在Login.js中添加变量xlLoginPara = {};16.在Login.js中的f_login函数中添加:if(eSugram){eSugram = eSugram;loginData.xl_unionid = xlLoginPara.xl_unionid;loginData.xl_nickname = xlLoginPara.xl_nickname;loginData.xl_headimgurl = xlLoginPara.xl_headimgurl;}17.在Login.js中修改函数autoLoginjsclient.autoLogin = function () {jsclient.block();var type = jsclient.operateFirstLoginType();var beginLogin = false;mylog("判断是否可以进行闲聊或者微信的自动登录type:" + type);if (type == "wx") {mylog("开始进行微信自动登录...");var WX_USER_LOGIN = sys.localStorage.getItem("WX_USER_LOGIN");if (WX_USER_LOGIN) {mylog("微信自动登录...");WX_USER_LOGIN = JSON.parse(WX_USER_LOGIN);LoginAsWeChat(WX_USER_LOGIN);beginLogin = true;}}else if (type == "xl") {mylog("开始进行闲聊自动登录...");var XL_USER_LOGIN = sys.localStorage.getItem("XL_USER_LOGIN");if (XL_USER_LOGIN) {mylog("闲聊自动登录...");XL_USER_LOGIN = JSON.parse(XL_USER_LOGIN);//mylog("XL_USER_LOGIN info:" + XL_USER_LOGIN);//闲聊登录信息初始化eSugram = true;xlLoginPara.xl_unionid = XL_USER_LOGIN.openId;xlLoginPara.xl_nickname = XL_USER_LOGIN.nickName;xlLoginPara.xl_headimgurl = XL_USER_LOGIN.smallAvatar;//闲聊登录f_login(xlLoginPara);beginLogin = true;}}else {mylog("开始进行loginData自动登录...");loginData = sys.localStorage.getItem("loginData");if (loginData) {mylog("loginData自动登录...");loginData = JSON.parse(loginData);f_login(loginData.mail, loginData.code);beginLogin = true;}}//在不能自动登录的时候去判断并执行是否是从游戏邀请链接启动的游戏if (!beginLogin) {jsclient.native.xlGetInviteGameInfo();}};18.在Login.js中LoginLayer的wechatLogin事件中添加:在login.js里自己定义一个var iswxLogin = false;_click: function (btn, etype) {if (agreeNode.isSelected()) {//点击微信登录就清除闲聊的登录信息(保证点什么登录游戏内就是该登录方式的信息)xlLoginPara = {};if (jsclient.native){iswxLogin = true;jsclient.native.wxLogin();}elseLoginAsGuest();}},19.在Login.js中LoginLayer添加按钮xianLiaoLogin的事件xianLiaoLogin: {_visible: function () {if (cc.sys.OS_WINDOWS == cc.sys.os || jsclient.remoteCfg.guestLogin /*|| jscl ient.sdk_control.xianliao*/) {return false;}else {return true;}},_run: function () {doLayout(this, [0.6, 0.13], [0.5, 0.5], [1.2, -2]);},_click: function () {mylog("点击闲聊登录");if (jsclient.native)jsclient.native.xlLogin();}},20.在Login.js中_event内添加XL_USER_LOGIN的事件响应XL_USER_LOGIN:function (para) {mylog("接收到XL_USER_LOGIN数据");jsclient.unblock();if (para) {//保存闲聊登录数据到本地var para = para.data;mylog("开始设置本地XL_USER_LOGIN...");cc.loader.loadTxt(jsb.fileUtils.getWritablePath() + "XLNickName.txt",function (er, txt) {if (txt) {//重置闲聊昵称para.nickName = escape(txt);//设置大头像信息为“”para.originalAvatar = "";//para.smallAvatar = "";//存储闲聊信息//sys.localStorage.setItem("XL_USER_LOGIN", JSON.stringify(par a));jsclient.operateFirstLoginType("xl");//闲聊登录信息初始化eSugram = true;xlLoginPara.xl_unionid = para.openId;xlLoginPara.xl_nickname = para.nickName;xlLoginPara.xl_headimgurl = para.smallAvatar;//闲聊登录mylog("开始进行闲聊登录...");f_login(xlLoginPara);}});}},21.在Login.js中_event内添加XL_LOGIN_MSG的事件响应XL_LOGIN_MSG:function (para) {if(para.errMsg){switch (para.errMsg){case "ERR_SUCCESS": //授权成功jsclient.block();break;case "ERR_CANCEL": //授权登录取消break;case "ERR_FAIL": //授权登录失败break;case "ERR_UNKNOW": //未知错误break;case "ERR_AFTERGETCODE": //获取code之后出错jsclient.unblock();break;}}},22.在Login.js中_event的WX_USER_LOGIN响应事件内添加WX_USER_LOGIN: function (para) {if (para.openid) {cc.loader.loadTxt(jsb.fileUtils.getWritablePath() + "nickname.txt",function (er, txt) {if (txt) {para.nickname = escape(txt);//sys.localStorage.setItem("WX_USER_LOGIN", JSON.stringify(par a));//jsclient.operateFirstLoginType("wx");//新的写法if(iswxLogin){sssys.localStorage.setItem("WX_USER_LOGIN",JSON.stringify(para));jsclient.operateFirstLoginType("wx");}LoginAsWeChat(para);}});}},23.在Login.js中_event的loginRtn响应事件内添加loginRtn: function (rtn) {if (rtn.result == ZJHCode.Success) {if (code) cc.sys.localStorage.setItem("loginData", JSON.stringify(loginData));var loginType = jsclient.operateFirstLoginType();if(loginType == "xl"){// mylog("登录成功2222!!!!!!!");var para = {};para.openId = xlLoginPara.xl_unionid;para.nickName = xlLoginPara.xl_nickname;para.smallAvatar = xlLoginPara.xl_headimgurl;sys.localStorage.setItem("XL_USER_LOGIN", JSON.stringify(para));...}}......else if(rtn.result == ZJHCode.needWxRegister){//需要微信登录if (agreeNode.isSelected()) {if (jsclient.native){iswxLogin = false;jsclient.native.wxLogin();}}}else if(rtn.result == ZJHCode.needWxId){//需要微信idjsclient.showMsg("微信id缺失!")}else if(rtn.result == ZJHCode.needXlId){//需要闲聊idjsclient.showMsg("闲聊id缺失!")}else if(rtn.result == ZJHCode.bindAnotherWxUser){//闲聊账号绑定了另外的微信idjsclient.showMsg("此微信账号不是您的闲聊账号所绑定的微信账号,请登录正确的微信账号!")}else if(rtn.result == ZJHCode.bindAnotherXlUser){//微信账号绑定了另外的闲聊idjsclient.showMsg("此闲聊账号不是您的微信账号所绑定的闲聊账号,请登录正确的闲聊账号!")}if (unblock)jsclient.unblock();}24.在Login.js中ctor函数内添加xlLoginPara = {};25.在myRooms.js中的Button_invite的点击事件中添加:Button_invite: {_click: function () {......//设置闲聊的parajsclient.xianLiaoPara = {};jsclient.xianLiaoPara.type = XianLiaoType.invite;jsclient.xianLiaoPara.roomId = info.tableid;jsclient.xianLiaoPara.roomToken = "{'gameType':'henmj'}";jsclient.xianLiaoPara.title = jsclient.uiPara.title;jsclient.xianLiaoPara.description = jsclient.uiPara.desc;......}},26.在Play.js中的邀请按钮的点击事件中添加:wxinvite: {......_click: function () {......//设置闲聊的parajsclient.xianLiaoPara = {};jsclient.xianLiaoPara.type = XianLiaoType.invite;jsclient.xianLiaoPara.roomId = tData.tableid;jsclient.xianLiaoPara.roomToken = "{'gameType':'henmj'}";jsclient.xianLiaoPara.title = jsclient.uiPara.title;jsclient.xianLiaoPara.description = jsclient.uiPara.desc;......}},27.在resource.js中添加:var XianLiaoType = {text:1, //文本分享image:2, //图片分享invite:3 //游戏邀请};jsclient.xianLiaoPara = {};28.在Result.js中添加:needWxId: 13, // 需要微信idneedXlId: 14, // 需要闲聊idbindAnotherWxUser: 15, // 闲聊账号绑定了另外的微信idbindAnotherXlUser: 16,needWxRegister: 17, // 需要微信注册29.在Update.js的ShareWXLayer中添加一个控件btn_xianliaobtn_xianliao: {_run: function () {......},_click: function () {jsclient.xlCheckAndShare();}}30.在Update.js的ShareWXLayer中的_event添加XL_USER_LOGINXL_USER_LOGIN:function (para) {jsclient.unblock();if(para){//保存闲聊登录数据到本地var para = para.data;cc.loader.loadTxt(jsb.fileUtils.getWritablePath() + "XLNickName.txt",function (er, txt) {if (txt) {//重置闲聊昵称para.nickName = escape(txt);//设置大头像信息为“”para.originalAvatar = "";//para.smallAvatar = "";//存储闲聊信息//sys.localStorage.setItem("XL_USER_LOGIN", JSON.stringify(par a));//绑定账号var unionid = jsclient.getWXunionid();jsclient.gamenet.request("pkcon.handler.bindSugramUser",{unionid: unionid,xl_unionid: para.openId},function (rtn) {if(rtn.result == ZJHCode.Success) {//存储闲聊信息sys.localStorage.setItem("XL_USER_LOGIN", JSON. stringify(para));jsclient.xlCheckAndShare();}else if(rtn.result == ZJHCode.needWxId){//需要微信idjsclient.showMsg("微信id缺失!")}else if(rtn.result == ZJHCode.needXlId){//需要闲聊idjsclient.showMsg("闲聊id缺失!")}else if(rtn.result == ZJHCode.bindAnotherWxUser){//闲聊账号绑定了另外的微信idjsclient.showMsg("此微信账号不是您的闲聊账号所绑定的微信账号,请登录正确的微信账号!")}else if(rtn.result == ZJHCode.bindAnotherXlUser){//微信账号绑定了另外的闲聊idjsclient.showMsg("此闲聊账号不是您的微信账号所绑定的闲聊账号,请登录正确的闲聊账号!")}});}});}},31.在Update.js的ShareWXLayer中的_event添加XL_LOGIN_MSGXL_LOGIN_MSG:function (para) {if(para.errMsg){switch (para.errMsg){case "ERR_SUCCESS": //授权成功jsclient.block();break;case "ERR_CANCEL": //授权登录取消break;case "ERR_FAIL": //授权登录失败break;case "ERR_UNKNOW": //未知错误break;case "ERR_AFTERGETCODE"://获取code之后出错jsclient.unblock();break;}}},32.在Update.js的ShareWXLayer中的_event添加XL_SHARE_MSGXL_SHARE_MSG:function (para) {if(para.errMsg){switch (para.errMsg){case "ERR_SUCCESS": //分享成功break;case "ERR_CANCEL": //分享取消break;case "ERR_FAIL": //分享失败break;case "ERR_UNKNOW": //未知错误break;}}},三、IOS篇1.在xcode中添加SugramApi.a、SugramApiManager.h、SugramApiObject.h三个文件2.在AppController.h中添加#import "xlSDK/SugramApiManager.h"#import "xlSDK/SugramApiObject.h"NSString * xl_access_token;NSString * xl_refresh_token;NSString * xl_openid;添加位置如下图:3.在AppController.mm中声明变量NSString * XL_AppID = @"cc93e2b4-4acb-400b-81fe-915ed5d6f7c1";NSString * XL_AppSecret = @"c8c7ceb3-cd08-40e3-85be-39d0592ed808";NSString * xl_access_token;NSString * xl_refresh_token;NSString * xl_openid;BOOL isAPPNewStart = true;std::string inviateMsgStr = "";4.在AppController.mm中didFinishLaunchingWithOptions中添加//注册闲聊[SugramApiManager registerApp:XL_AppID];//是否为闲聊版本cocos2d::FileUtils::getInstance()->writeStringToFile("control",cocos2d::FileUtils::getInstance() ->getWritablePath()+"/xianliao.txt");//注册从闲聊跳转过来的游戏调用,注册了以后从Sugram调起你的游戏APP时会以下的block,如果重复执行这个方法,会执行最后注册的block[SugramApiManager getGameFromSugram:^(NSString *roomToken, NSString *roomId, N SNumber *openId) {NSString *gameString0 = [NSString stringWithFormat:@"roomToken:%@,roomId:% @,openId:%@", roomToken, roomId, openId];NSString *gameString = [NSString stringWithFormat:@"{roomToken:%@,roomId:%@} ", roomToken, roomId];if(![roomToken isEqual: @""] && ![roomId isEqual: @""]){if(gameString){dispatch_async(dispatch_get_main_queue(), ^{std::string result_c_str= [gameString cStringUsingEncoding: NSUTF8St ringEncoding];std::string event ="XL_InviteGameInfo";std::string funName ="cc.eventManager.dispatchCustomEvent";std::string rStr = funName + "(\"" + event + "\"," + result_c_str + ");";if(!isAPPNewStart){NSString *printStr = [NSString stringWithCString:rStr.c_str() enco ding:[NSString defaultCStringEncoding]];NSLog(@"printStr:%@",printStr);ScriptingCore::getInstance()->evalString(rStr.c_str());NSLog(@"已发送闲聊邀请信息(已启动应用)。
sdk接入标准及流程规范

sdk接入标准及流程规范## Standard and Process Specification for SDK Integration.### SDK Integration Standards.1. Compatibility.The SDK should be compatible with multiple operating systems and devices. It should be able to seamlessly integrate with various applications and operating systems.2. Security.The SDK must adhere to industry-standard security protocols to ensure user data protection. This includes measures such as encryption, tokenization, and data anonymization.3. Performance.The SDK should be lightweight and efficient to avoid impacting the performance of the host application. It should minimize resource consumption, such as battery life and memory usage.4. Documentation and Support.The SDK must come with comprehensive documentation and support resources for developers. This includes clear and concise guidelines, tutorials, and reference materials. Dedicated technical support should also be available to assist with integration and troubleshooting.5. Customization.The SDK should allow for customization to meet specific business requirements. It should provide configuration options and APIs that enable developers to tailor the SDK's functionality to their needs.### SDK Integration Process.1. Development Environment Setup.Before integrating the SDK, developers should ensure they have the necessary development environment set up. This includes installing the SDK, any dependencies, and the required software tools.2. SDK Initialization.To use the SDK, developers must initialize it within their application. This involves specifying the necessary parameters and configuration settings.3. Data Collection and Processing.The SDK collects and processes data based on the configured settings. It may gather information such as device properties, user behavior, and event logs.4. Event Tracking.The SDK allows developers to track specific events within their application. These events can be customized to capture user interactions, session starts/stops, or errors.5. Data Transmission.Collected data is typically transmitted to a remote server or data warehouse for analysis and processing. The SDK should handle data transmission securely and efficiently.6. Performance Monitoring.Developers should monitor the performance of the SDK to ensure it is not adversely affecting the host application. This includes tracking resource consumption and identifying any potential bottlenecks.7. Updates and Maintenance.As the SDK evolves, developers should regularly update to the latest version to benefit from new features, bugfixes, and security improvements.### Additional Considerations.In addition to the above, consider the followingfactors when integrating an SDK:Cost: Determine any licensing fees or subscription costs associated with the SDK.Data Usage: Understand how the SDK collects and uses user data, and ensure compliance with relevant data protection regulations.Vendor Support: Evaluate the level of support provided by the SDK vendor and its reputation in the industry.## SDK 集成标准及流程规范。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
基于ApkPlug以组件形式调用ShareSDK目录一,项目目的 (2)二,项目所使用到的开发库 (2)三,项目目录结构 (2)四,使用步骤 (2)1,导入ApkPlug框架 (2)2,导入ShareSDK调用库 (3)3,配置相关权限 (3)4,配置相关activity (3)5,调用ShareSDK组件 (5)6,操作演示 (6)一,项目目的利用ApkPlug插件化框架将ShareSDK组件化,以实现按需动态加载和减小应用体积的目的。
ShareSDK是非常棒的移动社会化分享和评论工具,相信我们在开发应用过程中都离不开它。
但是当我们集成ShareSDK时候同样会遇到一些问题。
1.ShareSDK包比较大,组合国内多家分享平台以后其SDK包的大小应该在1M以上,这对应用来说还是不小的负荷。
2.集成ShareSDK过程中我们不可避免的需要将它的资源文件复制到应用的res资源目录下,这对我们应用后期维护造成不小的干扰。
基于以上的两大情况,我想通过ApkPlug框架将ShareSDK整体做成组件,在用户需要的时候才动态的从服务端加载到本地,这样做很方便的就解决了以上两个问题。
二,项目所使用到的开发库Apkplug v2.7.5版本 (必须是v2.7.5以上版本,否则无法运行)Apkplug插件托管服务 v1.8.0版本以上ShareSDK v2.10.7 (使用的最新版本DEMO)三,项目目录结构ShareSDKMain ---主应用演示DEMOShareSDKPlug ---ShareSDK 组件的具体实现PlugShareSDK1.0.0.jar --组件调用库四,使用步骤1,导入ApkPlug框架将Bundle2.7.5-Dev.jar 和 ApkplugCloudService1.8.0-Release.jar 拷贝到主应用libs目录下Bundle2.7.5-Dev.jar 是apkplug核心库 (v2.7.5版本以后只需要该文件即可不在需要libndkfoo.so)ApkplugCloudService1.8.0-Release.jar 是apkplug插件托管服务SDK,我们用它下载服务端的ShareSDK组件2,导入ShareSDK调用库将PlugShareSDK1.0.0.jar拷贝到主应用的libs目录下,它是ShareSDK组件的调用库,它封装了ShareSDK组件的调用接口,以及如果从apkplug插件托管服务下载组件的业务逻辑。
3,配置相关权限<!-- APKPLUG框架须要的权限--><uses-permissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission><uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/> <uses-permission android:name="android.permission.INTERNET"/><uses-permission android:name="android.permission.READ_PHONE_STATE"/><!-- ShareSDK须要的权限--><uses-permission android:name="android.permission.GET_TASKS"/><uses-permission android:name="android.permission.INTERNET"/><uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/><uses-permission android:name="android.permission.READ_PHONE_STATE"/><uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/><uses-permission android:name="android.permission.GET_ACCOUNTS"/>4,配置相关activity<!-- APKPLUG框架须要的Activity配置--><activityandroid:name="org.apkplug.app.apkplugActivity"android:theme="@android:style/Theme.Translucent"android:configChanges="orientation|keyboardHidden"/><!-- ShareSDK须要的Activity配置--><!-- 微信分享回调--><activityandroid:name="cn.sharesdk.socialization.sample.wxapi.WXEntryActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"android:configChanges="keyboardHidden|orientation|screenSize"android:exported="true"android:screenOrientation="portrait"/><!-- 易信分享回调--><activityandroid:name="cn.sharesdk.socialization.sample.yxapi.YXEntryActivity"android:theme="@android:style/Theme.Translucent.NoTitleBar"android:configChanges="keyboardHidden|orientation|screenSize"android:excludeFromRecents="true"android:exported="true"android:launchMode="singleTop"/><activityandroid:name="cn.sharesdk.framework.ShareSDKUIShell"android:theme="@android:style/Theme.Translucent.NoTitleBar"android:configChanges="keyboardHidden|orientation|screenSize"android:windowSoftInputMode="stateHidden|adjustResize"><!--Adapter表示一个继承自cn.sharesdk.framework.authorize.AuthorizeAdapter的类,这个类可以监听到页面的生命周期,也可以获取授权页面的各种UI控件。
开发者可以通过继承AuthorizeAdapter,重写其方法,并获取各种UI来自定义这个页面的行为。
<meta-data android:name="Adapter" android:value="cn.sharesdk.demo.MyAdapter" />--><!--Dropbox的SSO功能需要在此处添加一个对ACTION_VIEW事件的过滤器,其中的scheme 是“db-”前缀再开发者应用的加上appKey。
如果此过滤器不设置,则不能完成SSO功能授权--><intent-filter><data android:scheme="db-7janx53ilz11gbs"/><action android:name="android.intent.action.VIEW"/><category android:name="android.intent.category.BROWSABLE"/><category android:name="android.intent.category.DEFAULT"/></intent-filter><!--如果集成QQ分享,或者使用QQ客户端来进行QQ空间的分享,须要在此处添加一个对ACTION_VIEW事件的过滤器,其中的scheme是“tencent”前缀再开发者应用的加上appId。
如果此过滤器不设置,则分享结束以后不能得到正确的回调--><intent-filter><data android:scheme="tencent100371282"/><action android:name="android.intent.action.VIEW"/><category android:name="android.intent.category.DEFAULT"/><category android:name="android.intent.category.BROWSABLE"/></intent-filter></activity>注释说明:ApkPlug框架的插件activity是不需要在宿主配置的,但ShareSDK的这几个Activity 是负责与外部应用通信回调的,因此需要在宿主配置。