Toggle navigation
Toggle navigation
This project
Loading...
Sign in
guangka
/
public_sdk_android
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
唐伟军
2020-08-27 15:32:18 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
29787b13c340befdea9d107f26501dab1b95058d
29787b13
1 parent
9886e7a3
添加扩展接口接入文档
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
142 additions
and
2 deletions
demo/app/build.gradle
doc/公共SDK扩展接口接入文档.md
demo/app/build.gradle
View file @
29787b1
apply
plugin:
'com.android.application'
android
{
compileSdkVersion
2
9
compileSdkVersion
2
8
buildToolsVersion
'29.0.2'
defaultConfig
{
applicationId
"com.ssjh.demo"
minSdkVersion
8
minSdkVersion
14
targetSdkVersion
28
versionCode
2
versionName
"1.0"
...
...
@@ -22,4 +22,16 @@ dependencies {
implementation
fileTree
(
include:
[
'*.jar'
,
'*.aar'
],
dir:
'libs'
)
// implementation 'com.android.support.constraint:constraint-layout:1.0.2'
//implementation files('libs/PoolSdk_V2_20200313.jar')
// implementation 'com.android.support:appcompat-v7:28.+'
// implementation 'com.android.support:support-v4:28.+'
//
// implementation 'com.android.support.constraint:constraint-layout:1.1.3'
// implementation 'com.android.support:design:28.+'
// implementation 'com.appsflyer:af-android-sdk:5.4.1'
// implementation 'com.android.installreferrer:installreferrer:1.0'
// implementation 'com.google.android.gms:play-services-ads-identifier:16.0.0'
compile
'com.google.firebase:firebase-core:16.0.6'
compile
'com.google.firebase:firebase-messaging:17.3.4'
}
...
...
doc/公共SDK扩展接口接入文档.md
0 → 100644
View file @
29787b1
# 公共SDK扩展接口接入文档 #
## 接入必读
`
扩展接口的调用均通过反射实现,方法名需要和公共协商统一,其调用一般分为三步:
1.
先判断是否可使用该功能( cp通过该方法的返回值判断是否在游戏界面显示相应的入口 ):
boolean returnBool = PoolSdkHelper.hasFunction({方法名});
2.
获取状态。当第一步中的结果返回 true 时,方才执行第二步,否则不执行;第二步非必接接口,其执行条件为当需要获取某个状态(比如:绑定,推送)时调用,否则可跳过此步骤直接执行第三步:
boolean returnState = PoolSdkHelper.hasFunction({方法名});
3.
具体设置。当第一步中的结果返回 true 时,如无需执行第二步请直接执行此步,否则请先执行第二步再执行此步骤,这一步的调用结果会通过游戏初始化传入的监听器传递给游戏,具体的返回码请见具体接口说明:
Map
<Object
,
Object
>
map = new HashMap
<
>();
PoolSdkHelper.callfunc({方法名},map);
`
### 具体接口说明如下
#### 第一步判断是否可使用该功能
| 接口名 | 方法名 | 返回结果 |
|-----------------------------|---------------------------|----------------------------------------|
| Facebook好友界面 | hasFaceBookFriendsView | true 执行第三步的相应接口,false 不显示入口 |
|-----------------------------|---------------------------|----------------------------------------|
| 分享到Facebook | hasShareFacebook | true 执行第三步的相应接口,false 不显示入口 |
|-----------------------------|---------------------------|----------------------------------------|
| 删除账号 | hasDeleteMember | true 执行第三步的相应接口,false 不显示入口 |
|-----------------------------|---------------------------|----------------------------------------|
| 显示公告 | hasShowNotice | true 执行第三步的相应接口,false 不显示入口 |
|-----------------------------|---------------------------|----------------------------------------|
| 显示cafe窗口 | hasNaverCafePlug | true 执行第三步的相应接口,false 不显示入口 |
|-----------------------------|---------------------------|----------------------------------------|
| 谷歌评论 | hasGoogleComment | true 执行第三步的相应接口,false 不显示入口 |
|-----------------------------|---------------------------|----------------------------------------|
| 绑定账号 | hasLinkedAccountView | true 执行第二步的相应接口,false 不显示入口 |
|-----------------------------|---------------------------|----------------------------------------|
| 设置推送 | hasPushView | true 执行第二步的相应接口,false 不显示入口 |
|-----------------------------|----------------------------|----------------------------------------|
#### 第二步获取状态(不用获取状态的功能请跳过此步骤执行第三步)
| 接口名 | 方法名 | 参数 | 返回结果 |
|------------------------|---------------------------|------------------------------------|---------------------------|
| 绑定账号 | getLinkedAccountStatus | Map集合,key表示绑定平台,比如谷歌就传 | "true" 表示绑定了该平台 |
| | | google,facebook就传facebook,不确定 | "false" 表示未绑定该平台 |
| | | 平台传other;value传""就好 | |
|------------------------|---------------------------|------------------------------------|---------------------------|
| 设置推送 | getPushStatus | Map集合,key表示推送类型,比如全体推送 | "true" 表示设置了该推送 |
| | | 就传enable,夜间推送就传night,广告推送 | "false" 表示未设置该推送 |
| | | 就传ad;value传""就好 | |
|------------------------|---------------------------|-------------------------------------|--------------------------|
#### 第三步设置功能
| 接口名 | 方法名 | 参数 | 返回状态码 |
|-----------------------------|---------------------------|--------------------------------------|-----------------------|
| Facebook好友界面 | showFaceBookFriendsView | null | 无 |
|-----------------------------|---------------------------|--------------------------------------|-----------------------|
| 分享到Facebook | showShareFacebookView | null | 成功 1104 失败 1204 |
|-----------------------------|---------------------------|--------------------------------------|-----------------------|
| 删除账号 | deleteMember | null | 成功 1107 失败 1207 |
|-----------------------------|---------------------------|--------------------------------------|-----------------------|
| 显示公告 | showNotice | null | 无 |
|-----------------------------|---------------------------|--------------------------------------|-----------------------|
| 显示cafe窗口 | showNaverCafePlug | null | 无 |
|-----------------------------|---------------------------|--------------------------------------|-----------------------|
| 谷歌评论 | showGoogleComment | null | 成功 1106 失败 1206 |
|-----------------------------|---------------------------|--------------------------------------|------------------------|
| 绑定账号(绑定) | createLinkingAccount | Map集合,key表示绑定平台,比如谷歌就传 | 成功 1100 失败 1200 |
| | | google,facebook就传facebook,不确定 | |
| | | 平台传other;value传""就好 | |
|----------------------------|---------------------------|---------------------------------------|------------------------|
| 绑定账号(解绑) | deleteLinkingAccount | Map集合,key表示绑定平台,比如谷歌就传 | 成功 1101 失败 1201 |
| | | google,facebook就传facebook,不确定 | |
| | | 平台传other;value传""就好 | |
|----------------------------|---------------------------|---------------------------------------|------------------------|
| 设置推送(允许) | setPushEnable | Map集合,key表示推送类型,比如全体推送 | 成功 1103 失败 1203 |
| | | 就传enable,夜间推送就传night,广告推送 | |
| | | 就传ad;value传""就好 | |
|----------------------------|---------------------------|---------------------------------------|------------------------|
| 设置推送(不允许) | setPushDisable | Map集合,key表示推送类型,比如全体推送 | 成功 1105 失败 1205 |
| | | 就传enable,夜间推送就传night,广告推送 | |
| | | 就传ad;value传""就好 | |
|---------------------------|----------------------------|---------------------------------------|------------------------|
### 接入事例
#### 无需进行第二步以 显示公告 为例
`
boolean hasShowNotice = PoolSdkHelper.hasFunction("hasShowNotice");
if(hasShowNotice){
//显示公告入口
}else{
//不显示公告入口
`
}
`
用户点击公告时
`
PoolSdkHelper.callFunc("showNotice",null);
`
#### 需要进行第二步获取状态以 绑定账号 为例
`
boolean hasLinkedAccountView = PoolSdkHelper.hasFunction("hasLinkedAccountView");
if(hasLinkedAccountView){
//显示公告入口
}else{
//不显示公告入口
`
}
`
获取绑定状态,以便知道显示解绑还是绑定视图
`
Map
<Object
,
Object
>
map = new HashMap
<
>();
map.put("google","");//以谷歌为例
String linkedAccountStatus = PoolSdkHelper.callFunc("getLinkedAccountStatus",map);
`
用户点击按钮改变状态时
`
if("true" == linkedAccountStatus){//已经绑定了
//此时为解绑
Map
<Object
,
Object
>
map = new HashMap
<
>();
map.put("google","");//以谷歌为例
PoolSdkHelper.callFunc("deleteLinkingAccount",map);//此结果的返回码如上表格
}
if("false" == linkedAccountStatus){//没有绑定
//此时为去绑定
Map
<Object
,
Object
>
map = new HashMap
<
>();
map.put("google","");//以谷歌为例
PoolSdkHelper.callFunc("createLinkingAccount",map);//此结果的返回码如上表格
}
`
Please
register
or
login
to post a comment