diff --git a/README b/README
deleted file mode 100644
index e69de29..0000000
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..d50c10a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,158 @@
+# Gump SDK 5 for Android接入文档
+
+V5.0.0
+2018年11月02日
+
+## 版本概述
+
+此版本为使用AndroidStudio开发的版本,使用aar在线依赖的方式提供sdk接入包,相对上一版本没有任何继承关系,请按此文档描述接入.
+
+此SDK适用android4.0以上系统.
+
+本SDK分为两个部分:登录和支付,请按需引用依赖包.
+
+## 第一章 接入指南
+### 1.依赖导入
+配置gradle,以下为必须项
+
+ repositories{
+ maven{
+ url "http://117.50.8.198:8081/nexus/content/repositories/sdk"
+ }
+ }
+ dependencies {
+ //基础功能依赖,必须
+ implementation 'com.gump:base:5.0.0'
+ //登录功能依赖
+ implementation 'com.gump:Passport:5.0.0'
+ //支付功能依赖
+ implementation 'com.gump:Payment:5.0.0'
+ }
+
+### 2.修改AndroidManifest.xml文件
+首先添加必要的权限,如下所示:
+
+
+
+
+
+
+
+创建一个strings 配置如下
+
+ your_play_games_app_id
+
+增加play games的meta-data配置
+
+
+
+
+### 3.1 初始化与配置
+*横竖屏控制,默认为横屏,参数为false即为竖屏
+
+ SDKAgent.getSettings().setScreenLandscape(true);
+
+*若要使用V4版支付请设置
+
+ SDKAgent.getSettings().setPaymentVersion(PaymentVersion.V4);
+
+*执行初始化
+
+ SDKAgent.init(Context,Appid,ChannelId);
+
+### 3.2 登录接入
+构建Passport实例
+
+ passport = new Passport.Builder().context(Context).setListener(StateListener).build();
+
+其中StateListener为登录状态监听接口,需要实现如下方法
+
+ //成功回调,成功事件类型由action枚举对象标识,player是成功返回的玩家对象
+ void onActionSucced(Actions action, GamePlayer player)
+ //失败回调
+ void onActionFailured()
+
+接下来,添加生命周期处理方法
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ passport.onResume();
+ }
+
+处理结果返回
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (!passport.onActivityResult(requestCode, resultCode, data))
+ super.onActivityResult(requestCode, resultCode, data);
+ }
+
+### 3.3 支付接入
+注册相应的Activity,具体如下:
+
+
+
+
+
+
+
+
+
+
+三方支付调用
+
+ Bundle payInfo = new Bundle();
+ payInfo.putString("product", "wa2");
+ payInfo.putFloat("amount", 0.1f);
+ payInfo.putString("extraInfo", "This is demo!");
+ payInfo.putString("serverId", "100");
+ payInfo.putString("roleId", "41080");
+ Payment.pay(Activity, payInfo, PurchaseCallback);
+
+Google IAB支付调用
+
+ Bundle payInfo = new Bundle();
+ payInfo.putString("product", "180010");
+ payInfo.putFloat("amount", 0.1f);
+ payInfo.putString("extraInfo", "This is demo!");
+ payInfo.putString("serverId", "100");
+ payInfo.putString("roleId", "41080");
+ Payment.launchIAP(Activity, payInfo, PurchaseCallback);
+
+PurchaseCallback为支付状态回调接口,此接口含有3个方法
+
+ @Override
+ public void onPurchaseCompleted(PurchaseResult result) {
+ Log.i(TAG,"purchase completed");
+ }
+
+ @Override
+ public void onPurchaseError(int code, String msg) {
+ Log.i(TAG,"purchase error");
+ }
+
+ @Override
+ public void onPurchaseCanceled() {
+ Log.i(TAG,"purchase canceled");
+ }
+
+## 第二章 常见问题
+### 问题1: 如何避免混淆对SDK的影响?
+解答:有些开发者对接入了SDK的程序进行混淆时,有可能会覆盖某些java
+类,导致SDK无法正常工作,解决方法如下:
+Ø 请开发者在混淆配置文件proguard.cfg或proguard-project.txt的最后加上
+
+ -keep class com.gump.payment.web.* {*;}
+
+使得混淆的时候不会影响SDK的命名空间。
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 47df5b7..e5923db 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,5 +1,6 @@
apply plugin: 'com.android.application'
+
android {
compileSdkVersion 27
defaultConfig {
@@ -17,23 +18,30 @@ android {
}
}
- applicationVariants.all{
- variant->
- variant.outputs.all{
- outputFileName = "SDKDemo-"+variant.name+defaultConfig.versionName+".apk"
+ applicationVariants.all {
+ variant ->
+ variant.outputs.all {
+ outputFileName = "SDKDemo-" + variant.name + defaultConfig.versionName + ".apk"
}
}
+
+ lintOptions {
+ abortOnError false
+ }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
- androidTestImplementation 'com.android.support.test:runner:1.0.2'
- androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
- implementation project(':base')
- implementation project(':passport')
- implementation project(':payment')
+ //基础功能依赖,必须
+ implementation 'com.gump:base:5.0.0'
+// implementation project(':base')
+ //登录功能依赖
+ implementation 'com.gump:Passport:5.0.0'
+// implementation project(':passport')
+ //支付功能依赖
+ implementation 'com.gump:Payment:5.0.0'
+// implementation project(':payment')
}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index f1b4245..53c146b 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -19,3 +19,4 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
+-keep class com.gump.payment.web.* {*;}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 8d3ef8e..e7f7eb5 100644
--- a/build.gradle
+++ b/build.gradle
@@ -19,6 +19,9 @@ allprojects {
repositories {
google()
jcenter()
+ maven{
+ url "http://117.50.8.198:8081/nexus/content/repositories/sdk"
+ }
}
}
diff --git a/settings.gradle b/settings.gradle
index e7b4def..9d495b3 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include ':app'
+include ':app'
\ No newline at end of file