Showing
2 changed files
with
142 additions
and
2 deletions
| 1 | apply plugin: 'com.android.application' | 1 | apply plugin: 'com.android.application' |
| 2 | 2 | ||
| 3 | android { | 3 | android { |
| 4 | - compileSdkVersion 29 | 4 | + compileSdkVersion 28 |
| 5 | buildToolsVersion '29.0.2' | 5 | buildToolsVersion '29.0.2' |
| 6 | defaultConfig { | 6 | defaultConfig { |
| 7 | applicationId "com.ssjh.demo" | 7 | applicationId "com.ssjh.demo" |
| 8 | - minSdkVersion 8 | 8 | + minSdkVersion 14 |
| 9 | targetSdkVersion 28 | 9 | targetSdkVersion 28 |
| 10 | versionCode 2 | 10 | versionCode 2 |
| 11 | versionName "1.0" | 11 | versionName "1.0" |
| ... | @@ -22,4 +22,16 @@ dependencies { | ... | @@ -22,4 +22,16 @@ dependencies { |
| 22 | implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs') | 22 | implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs') |
| 23 | // implementation 'com.android.support.constraint:constraint-layout:1.0.2' | 23 | // implementation 'com.android.support.constraint:constraint-layout:1.0.2' |
| 24 | //implementation files('libs/PoolSdk_V2_20200313.jar') | 24 | //implementation files('libs/PoolSdk_V2_20200313.jar') |
| 25 | +// implementation 'com.android.support:appcompat-v7:28.+' | ||
| 26 | +// implementation 'com.android.support:support-v4:28.+' | ||
| 27 | +// | ||
| 28 | +// implementation 'com.android.support.constraint:constraint-layout:1.1.3' | ||
| 29 | +// implementation 'com.android.support:design:28.+' | ||
| 30 | + | ||
| 31 | +// implementation 'com.appsflyer:af-android-sdk:5.4.1' | ||
| 32 | +// implementation 'com.android.installreferrer:installreferrer:1.0' | ||
| 33 | + | ||
| 34 | +// implementation 'com.google.android.gms:play-services-ads-identifier:16.0.0' | ||
| 35 | + compile 'com.google.firebase:firebase-core:16.0.6' | ||
| 36 | + compile 'com.google.firebase:firebase-messaging:17.3.4' | ||
| 25 | } | 37 | } | ... | ... |
doc/公共SDK扩展接口接入文档.md
0 → 100644
| 1 | +# 公共SDK扩展接口接入文档 # | ||
| 2 | + | ||
| 3 | +## 接入必读 | ||
| 4 | + `扩展接口的调用均通过反射实现,方法名需要和公共协商统一,其调用一般分为三步: | ||
| 5 | + 1.先判断是否可使用该功能( cp通过该方法的返回值判断是否在游戏界面显示相应的入口 ): | ||
| 6 | + boolean returnBool = PoolSdkHelper.hasFunction({方法名}); | ||
| 7 | + 2.获取状态。当第一步中的结果返回 true 时,方才执行第二步,否则不执行;第二步非必接接口,其执行条件为当需要获取某个状态(比如:绑定,推送)时调用,否则可跳过此步骤直接执行第三步: | ||
| 8 | + boolean returnState = PoolSdkHelper.hasFunction({方法名}); | ||
| 9 | + 3.具体设置。当第一步中的结果返回 true 时,如无需执行第二步请直接执行此步,否则请先执行第二步再执行此步骤,这一步的调用结果会通过游戏初始化传入的监听器传递给游戏,具体的返回码请见具体接口说明: | ||
| 10 | + Map<Object,Object> map = new HashMap<>(); | ||
| 11 | + PoolSdkHelper.callfunc({方法名},map);` | ||
| 12 | + | ||
| 13 | +### 具体接口说明如下 | ||
| 14 | + | ||
| 15 | +#### 第一步判断是否可使用该功能 | ||
| 16 | + | ||
| 17 | +| 接口名 | 方法名 | 返回结果 | | ||
| 18 | +|-----------------------------|---------------------------|----------------------------------------| | ||
| 19 | +| Facebook好友界面 | hasFaceBookFriendsView | true 执行第三步的相应接口,false 不显示入口 | | ||
| 20 | +|-----------------------------|---------------------------|----------------------------------------| | ||
| 21 | +| 分享到Facebook | hasShareFacebook | true 执行第三步的相应接口,false 不显示入口 | | ||
| 22 | +|-----------------------------|---------------------------|----------------------------------------| | ||
| 23 | +| 删除账号 | hasDeleteMember | true 执行第三步的相应接口,false 不显示入口 | | ||
| 24 | +|-----------------------------|---------------------------|----------------------------------------| | ||
| 25 | +| 显示公告 | hasShowNotice | true 执行第三步的相应接口,false 不显示入口 | | ||
| 26 | +|-----------------------------|---------------------------|----------------------------------------| | ||
| 27 | +| 显示cafe窗口 | hasNaverCafePlug | true 执行第三步的相应接口,false 不显示入口 | | ||
| 28 | +|-----------------------------|---------------------------|----------------------------------------| | ||
| 29 | +| 谷歌评论 | hasGoogleComment | true 执行第三步的相应接口,false 不显示入口 | | ||
| 30 | +|-----------------------------|---------------------------|----------------------------------------| | ||
| 31 | +| 绑定账号 | hasLinkedAccountView | true 执行第二步的相应接口,false 不显示入口 | | ||
| 32 | +|-----------------------------|---------------------------|----------------------------------------| | ||
| 33 | +| 设置推送 | hasPushView | true 执行第二步的相应接口,false 不显示入口 | | ||
| 34 | +|-----------------------------|----------------------------|----------------------------------------| | ||
| 35 | + | ||
| 36 | +#### 第二步获取状态(不用获取状态的功能请跳过此步骤执行第三步) | ||
| 37 | + | ||
| 38 | +| 接口名 | 方法名 | 参数 | 返回结果 | | ||
| 39 | +|------------------------|---------------------------|------------------------------------|---------------------------| | ||
| 40 | +| 绑定账号 | getLinkedAccountStatus | Map集合,key表示绑定平台,比如谷歌就传 | "true" 表示绑定了该平台 | | ||
| 41 | +| | | google,facebook就传facebook,不确定 | "false" 表示未绑定该平台 | | ||
| 42 | +| | | 平台传other;value传""就好 | | | ||
| 43 | +|------------------------|---------------------------|------------------------------------|---------------------------| | ||
| 44 | +| 设置推送 | getPushStatus | Map集合,key表示推送类型,比如全体推送 | "true" 表示设置了该推送 | | ||
| 45 | +| | | 就传enable,夜间推送就传night,广告推送 | "false" 表示未设置该推送 | | ||
| 46 | +| | | 就传ad;value传""就好 | | | ||
| 47 | +|------------------------|---------------------------|-------------------------------------|--------------------------| | ||
| 48 | + | ||
| 49 | + | ||
| 50 | +#### 第三步设置功能 | ||
| 51 | + | ||
| 52 | +| 接口名 | 方法名 | 参数 | 返回状态码 | | ||
| 53 | +|-----------------------------|---------------------------|--------------------------------------|-----------------------| | ||
| 54 | +| Facebook好友界面 | showFaceBookFriendsView | null | 无 | | ||
| 55 | +|-----------------------------|---------------------------|--------------------------------------|-----------------------| | ||
| 56 | +| 分享到Facebook | showShareFacebookView | null | 成功 1104 失败 1204 | | ||
| 57 | +|-----------------------------|---------------------------|--------------------------------------|-----------------------| | ||
| 58 | +| 删除账号 | deleteMember | null | 成功 1107 失败 1207 | | ||
| 59 | +|-----------------------------|---------------------------|--------------------------------------|-----------------------| | ||
| 60 | +| 显示公告 | showNotice | null | 无 | | ||
| 61 | +|-----------------------------|---------------------------|--------------------------------------|-----------------------| | ||
| 62 | +| 显示cafe窗口 | showNaverCafePlug | null | 无 | | ||
| 63 | +|-----------------------------|---------------------------|--------------------------------------|-----------------------| | ||
| 64 | +| 谷歌评论 | showGoogleComment | null | 成功 1106 失败 1206 | | ||
| 65 | +|-----------------------------|---------------------------|--------------------------------------|------------------------| | ||
| 66 | +| 绑定账号(绑定) | createLinkingAccount | Map集合,key表示绑定平台,比如谷歌就传 | 成功 1100 失败 1200 | | ||
| 67 | +| | | google,facebook就传facebook,不确定 | | | ||
| 68 | +| | | 平台传other;value传""就好 | | | ||
| 69 | +|----------------------------|---------------------------|---------------------------------------|------------------------| | ||
| 70 | +| 绑定账号(解绑) | deleteLinkingAccount | Map集合,key表示绑定平台,比如谷歌就传 | 成功 1101 失败 1201 | | ||
| 71 | +| | | google,facebook就传facebook,不确定 | | | ||
| 72 | +| | | 平台传other;value传""就好 | | | ||
| 73 | +|----------------------------|---------------------------|---------------------------------------|------------------------| | ||
| 74 | +| 设置推送(允许) | setPushEnable | Map集合,key表示推送类型,比如全体推送 | 成功 1103 失败 1203 | | ||
| 75 | +| | | 就传enable,夜间推送就传night,广告推送 | | | ||
| 76 | +| | | 就传ad;value传""就好 | | | ||
| 77 | +|----------------------------|---------------------------|---------------------------------------|------------------------| | ||
| 78 | +| 设置推送(不允许) | setPushDisable | Map集合,key表示推送类型,比如全体推送 | 成功 1105 失败 1205 | | ||
| 79 | +| | | 就传enable,夜间推送就传night,广告推送 | | | ||
| 80 | +| | | 就传ad;value传""就好 | | | ||
| 81 | +|---------------------------|----------------------------|---------------------------------------|------------------------| | ||
| 82 | + | ||
| 83 | +### 接入事例 | ||
| 84 | +#### 无需进行第二步以 显示公告 为例 | ||
| 85 | + ` | ||
| 86 | + boolean hasShowNotice = PoolSdkHelper.hasFunction("hasShowNotice"); | ||
| 87 | + if(hasShowNotice){ | ||
| 88 | + //显示公告入口 | ||
| 89 | + }else{ | ||
| 90 | + //不显示公告入口` | ||
| 91 | + } | ||
| 92 | + ` | ||
| 93 | + 用户点击公告时 | ||
| 94 | + ` | ||
| 95 | + PoolSdkHelper.callFunc("showNotice",null); | ||
| 96 | + ` | ||
| 97 | + | ||
| 98 | +#### 需要进行第二步获取状态以 绑定账号 为例 | ||
| 99 | + ` | ||
| 100 | + boolean hasLinkedAccountView = PoolSdkHelper.hasFunction("hasLinkedAccountView"); | ||
| 101 | + if(hasLinkedAccountView){ | ||
| 102 | + //显示公告入口 | ||
| 103 | + }else{ | ||
| 104 | + //不显示公告入口` | ||
| 105 | + } | ||
| 106 | + ` | ||
| 107 | + 获取绑定状态,以便知道显示解绑还是绑定视图 | ||
| 108 | + ` | ||
| 109 | + Map<Object,Object> map = new HashMap<>(); | ||
| 110 | + map.put("google","");//以谷歌为例 | ||
| 111 | + String linkedAccountStatus = PoolSdkHelper.callFunc("getLinkedAccountStatus",map); | ||
| 112 | + ` | ||
| 113 | + 用户点击按钮改变状态时 | ||
| 114 | + ` | ||
| 115 | + if("true" == linkedAccountStatus){//已经绑定了 | ||
| 116 | + //此时为解绑 | ||
| 117 | + Map<Object,Object> map = new HashMap<>(); | ||
| 118 | + map.put("google","");//以谷歌为例 | ||
| 119 | + PoolSdkHelper.callFunc("deleteLinkingAccount",map);//此结果的返回码如上表格 | ||
| 120 | + } | ||
| 121 | + if("false" == linkedAccountStatus){//没有绑定 | ||
| 122 | + //此时为去绑定 | ||
| 123 | + Map<Object,Object> map = new HashMap<>(); | ||
| 124 | + map.put("google","");//以谷歌为例 | ||
| 125 | + PoolSdkHelper.callFunc("createLinkingAccount",map);//此结果的返回码如上表格 | ||
| 126 | + } | ||
| 127 | + ` | ||
| 128 | + |
-
Please register or login to post a comment