Commit f97711df6009879c5f4e87a11a373925526436c5
1 parent
f396f1ebd5
Exists in
master
the demo for sdk v4.6.2
Showing 5 changed files with 25 additions and 51 deletions Inline Diff
GameSDKDemo/build.gradle
1 | apply plugin: 'com.android.application' | 1 | apply plugin: 'com.android.application' |
2 | 2 | ||
3 | /*gump test config,you could ignore it | 3 | /*The config for internal testing,you could ignore it |
4 | * gump打包测试使用,你可以自行配置,或者直接删除这部分内容 | 4 | * gump内部测试使用,你可以自行配置,或者直接删除这部分内容 |
5 | * --start-- | ||
5 | */ | 6 | */ |
6 | def keystorePSW = '' | 7 | def keystorePSW = '' |
7 | def keystoreAlias = '' | 8 | def keystoreAlias = '' |
8 | def keystoreAliasPSW = '' | 9 | def keystoreAliasPSW = '' |
9 | // default keystore file, PLZ config file path in local.properties | 10 | // default keystore file, PLZ config file path in local.properties |
10 | def keyfile = file('s.keystore.temp') | 11 | def keyfile = file('s.keystore.temp') |
11 | 12 | ||
12 | Properties properties = new Properties() | 13 | Properties properties = new Properties() |
13 | // local.properties file in the root director | 14 | // local.properties file in the root director |
14 | properties.load(project.file('local.properties').newDataInputStream()) | 15 | properties.load(project.file('local.properties').newDataInputStream()) |
15 | def keystoreFilepath = properties.getProperty("keystore.path") | 16 | def keystoreFilepath = properties.getProperty("keystore.path") |
16 | 17 | ||
17 | if (keystoreFilepath) { | 18 | if (keystoreFilepath) { |
18 | keystorePSW = properties.getProperty("keystore.password") | 19 | keystorePSW = properties.getProperty("keystore.password") |
19 | keystoreAlias = properties.getProperty("keystore.alias") | 20 | keystoreAlias = properties.getProperty("keystore.alias") |
20 | keystoreAliasPSW = properties.getProperty("keystore.key_passwd") | 21 | keystoreAliasPSW = properties.getProperty("keystore.key_passwd") |
21 | keyfile = file(keystoreFilepath) | 22 | keyfile = file(keystoreFilepath) |
22 | } | 23 | } |
23 | /* | 24 | /* |
24 | * gump test config,you could ignore it | 25 | * The config for internal testing,you could ignore it |
25 | * gump打包测试使用,你可以自行配置,或者直接删除这部分内容 | 26 | * gump内部测试使用,你可以自行配置,或者直接删除这部分内容 |
27 | * --end-- | ||
26 | */ | 28 | */ |
27 | 29 | ||
28 | repositories { | 30 | repositories { |
29 | maven{ | 31 | maven { |
30 | url "http://117.50.8.198:8081/nexus/content/repositories/sdk" | 32 | url "http://117.50.8.198:8081/nexus/content/repositories/sdk" |
31 | } | 33 | } |
32 | jcenter() | 34 | jcenter() |
33 | google() | 35 | google() |
34 | } | 36 | } |
35 | 37 | ||
36 | android { | 38 | android { |
37 | compileSdkVersion 26 | 39 | compileSdkVersion 26 |
38 | buildToolsVersion "27.0.3" | 40 | buildToolsVersion '28.0.3' |
39 | 41 | ||
40 | signingConfigs { | 42 | signingConfigs { |
41 | release { | 43 | release { |
42 | storeFile keyfile | 44 | storeFile keyfile |
43 | storePassword keystorePSW | 45 | storePassword keystorePSW |
44 | keyPassword keystoreAliasPSW | 46 | keyPassword keystoreAliasPSW |
45 | keyAlias keystoreAlias | 47 | keyAlias keystoreAlias |
46 | } | 48 | } |
47 | } | 49 | } |
48 | 50 | ||
49 | defaultConfig { | 51 | defaultConfig { |
50 | minSdkVersion 14 | 52 | minSdkVersion 14 |
51 | targetSdkVersion 26 | 53 | targetSdkVersion 26 |
52 | versionCode 5 | 54 | versionCode 6 |
53 | versionName "1.3" | 55 | versionName "1.4" |
54 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | 56 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" |
55 | signingConfig signingConfigs.release | 57 | signingConfig signingConfigs.release |
56 | } | 58 | } |
57 | buildTypes { | 59 | buildTypes { |
58 | release { | 60 | release { |
59 | minifyEnabled false | 61 | minifyEnabled false |
60 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | 62 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
61 | zipAlignEnabled true | 63 | zipAlignEnabled true |
62 | } | 64 | } |
63 | debug { | 65 | debug { |
64 | signingConfig signingConfigs.release | 66 | signingConfig signingConfigs.release |
65 | } | 67 | } |
66 | } | 68 | } |
67 | lintOptions { | 69 | lintOptions { |
68 | abortOnError false | 70 | abortOnError false |
69 | } | 71 | } |
70 | 72 | ||
73 | applicationVariants.all{ | ||
74 | variant-> | ||
75 | variant.outputs.all{ | ||
76 | outputFileName = "GameSDKDemo-"+variant.name+defaultConfig.versionName+".apk" | ||
77 | } | ||
78 | } | ||
79 | |||
71 | } | 80 | } |
72 | 81 | ||
73 | dependencies { | 82 | dependencies { |
74 | implementation fileTree(include: ['*.jar'], dir: 'libs') | 83 | implementation fileTree(include: ['*.jar'], dir: 'libs') |
75 | testImplementation 'junit:junit:4.12' | 84 | testImplementation 'junit:junit:4.12' |
76 | implementation 'com.android.support:appcompat-v7:26.1.0' | 85 | implementation 'com.android.support:appcompat-v7:26.1.0' |
77 | //微信 | 86 | // implementation project(':GameSDK') |
78 | implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:5.1.4' | 87 | implementation 'com.gumptech.sdk:GameSDK:4.6.2' |
79 | //VK | ||
80 | implementation 'com.gumptech:VKsdk:1.5.4' |
GameSDKDemo/release/GameSDKDemo-release.apk
No preview for this file type
GameSDKDemo/src/main/AndroidManifest.xml
1 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | 1 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
2 | package="com.gumptech.sdk.demo"> | 2 | package="com.gumptech.sdk.demo"> |
3 | 3 | ||
4 | 4 | ||
5 | <uses-sdk | ||
6 | android:minSdkVersion="9" | ||
7 | android:targetSdkVersion="23"/> | ||
8 | |||
9 | <uses-permission android:name="android.permission.INTERNET"/> | 5 | <uses-permission android:name="android.permission.INTERNET"/> |
10 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> | 6 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> |
11 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> | 7 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> |
12 | <!-- Danger Level permission--> | 8 | <!-- Danger Level permission--> |
13 | 9 | ||
14 | <!-- VERY IMPORTANT! Don't forget this permission, or in-app billing won't work. --> | 10 | <!-- VERY IMPORTANT! Don't forget this permission, or in-app billing won't work. --> |
15 | <uses-permission android:name="com.android.vending.BILLING"/> | 11 | <uses-permission android:name="com.android.vending.BILLING"/> |
16 | 12 | ||
17 | <application | 13 | <application |
18 | android:allowBackup="true" | 14 | android:allowBackup="true" |
19 | android:icon="@drawable/ic_launcher" | 15 | android:icon="@drawable/ic_launcher" |
20 | android:label="@string/app_name"> | 16 | android:label="@string/app_name"> |
21 | <activity | 17 | <activity |
22 | android:name="com.gumptech.sdk.demo.MainActivity" | 18 | android:name="com.gumptech.sdk.demo.MainActivity" |
23 | android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" | 19 | android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" |
24 | android:label="@string/app_name" | 20 | android:label="@string/app_name" |
25 | android:screenOrientation="landscape"> | 21 | android:screenOrientation="landscape"> |
26 | <intent-filter> | 22 | <intent-filter> |
27 | <action android:name="android.intent.action.MAIN"/> | 23 | <action android:name="android.intent.action.MAIN"/> |
28 | 24 | ||
29 | <category android:name="android.intent.category.LAUNCHER"/> | 25 | <category android:name="android.intent.category.LAUNCHER"/> |
30 | </intent-filter> | 26 | </intent-filter> |
31 | </activity> | 27 | </activity> |
32 | <activity | 28 | <activity |
33 | android:name="com.gumptech.sdk.ContainerActivity" | 29 | android:name="com.gumptech.sdk.ContainerActivity" |
34 | android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" | 30 | android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" |
35 | android:launchMode="singleTask" | 31 | android:launchMode="singleTask" |
36 | android:theme="@style/Theme.TransparentWin" | 32 | android:theme="@style/Theme.TransparentWin" |
37 | android:windowSoftInputMode="stateAlwaysHidden|adjustPan"> | 33 | android:windowSoftInputMode="stateAlwaysHidden|adjustPan"> |
38 | </activity> | 34 | </activity> |
39 | <activity | 35 | <activity |
40 | android:name="com.gumptech.sdk.PaymentActivity" | 36 | android:name="com.gumptech.sdk.PaymentActivity" |
41 | android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" | 37 | android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" |
42 | android:launchMode="singleTask" | 38 | android:launchMode="singleTask" |
43 | android:theme="@android:style/Theme.Light.NoTitleBar"> | 39 | android:theme="@android:style/Theme.Light.NoTitleBar"> |
44 | <intent-filter> | 40 | <intent-filter> |
45 | <category android:name="android.intent.category.DEFAULT"/> | 41 | <category android:name="android.intent.category.DEFAULT"/> |
46 | 42 | ||
47 | <action android:name="android.intent.action.VIEW"/> | 43 | <action android:name="android.intent.action.VIEW"/> |
48 | 44 | ||
49 | <category android:name="android.intent.category.BROWSABLE"/> | 45 | <category android:name="android.intent.category.BROWSABLE"/> |
50 | 46 | ||
51 | <data | 47 | <data |
52 | android:host="com.gump.sdk" | 48 | android:host="com.gump.sdk" |
53 | android:scheme="gump10031"/> | 49 | android:scheme="gump100"/> |
54 | </intent-filter> | 50 | </intent-filter> |
55 | </activity> | 51 | </activity> |
56 | 52 | ||
57 | <!--wechat--> | ||
58 | <!-- vk --> | ||
59 | <!-- <activity android:name="com.vk.com.gumptech.sdk.VKOpenAuthActivity" /> --> | ||
60 | <!-- <activity --> | ||
61 | <!-- android:name="com.vk.com.gumptech.sdk.VKServiceActivity" --> | ||
62 | <!-- android:label="ServiceActivity" --> | ||
63 | <!-- android:theme="@style/VK.Transparent" /> --> | ||
64 | </application> | 53 | </application> |
65 | 54 | ||
66 | 55 | ||
67 | </manifest> | 56 | </manifest> |
68 | 57 |
GameSDKDemo/src/main/java/com/gumptech/sdk/demo/MainActivity.java
1 | package com.gumptech.sdk.demo; | 1 | package com.gumptech.sdk.demo; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
5 | import android.util.Log; | 5 | import android.util.Log; |
6 | import android.view.View; | 6 | import android.view.View; |
7 | import android.widget.Button; | 7 | import android.widget.Button; |
8 | import android.widget.TextView; | 8 | import android.widget.TextView; |
9 | import android.widget.Toast; | 9 | import android.widget.Toast; |
10 | 10 | ||
11 | import com.gumptech.sdk.GumpPreference; | 11 | import com.gumptech.sdk.GumpPreference; |
12 | import com.gumptech.sdk.GumpSDK; | 12 | import com.gumptech.sdk.GumpSDK; |
13 | import com.gumptech.sdk.PaymentVersion; | 13 | import com.gumptech.sdk.PaymentVersion; |
14 | import com.gumptech.sdk.SDKSettings; | 14 | import com.gumptech.sdk.SDKSettings; |
15 | import com.gumptech.sdk.bean.GumpUser; | 15 | import com.gumptech.sdk.bean.GumpUser; |
16 | import com.gumptech.sdk.bean.PurchaseResult; | 16 | import com.gumptech.sdk.bean.PurchaseResult; |
17 | import com.gumptech.sdk.callback.InitializeCallback; | 17 | import com.gumptech.sdk.callback.InitializeCallback; |
18 | import com.gumptech.sdk.callback.LoginStateListener; | 18 | import com.gumptech.sdk.callback.LoginStateListener; |
19 | import com.gumptech.sdk.callback.PurchaseCallback; | 19 | import com.gumptech.sdk.callback.PurchaseCallback; |
20 | import com.gumptech.sdk.callback.ResultCallback; | 20 | import com.gumptech.sdk.callback.ResultCallback; |
21 | import com.gumptech.sdk.passport.fb.FBAccessToken; | 21 | import com.gumptech.sdk.passport.fb.FBAccessToken; |
22 | 22 | ||
23 | import java.util.Locale; | 23 | import java.util.Locale; |
24 | 24 | ||
25 | public class MainActivity extends Activity implements PurchaseCallback { | 25 | public class MainActivity extends Activity implements PurchaseCallback { |
26 | 26 | ||
27 | private static final String TAG = "MainActivity"; | 27 | private static final String TAG = "MainActivity"; |
28 | 28 | ||
29 | private TextView tvVersion; | 29 | private TextView tvVersion; |
30 | private TextView userInfo; | 30 | private TextView userInfo; |
31 | 31 | ||
32 | private Button btnLoginOrLogout; | 32 | private Button btnLoginOrLogout; |
33 | private Button btnInit; | 33 | private Button btnInit; |
34 | 34 | ||
35 | private String appId = "100"; | 35 | private String appId = "100"; |
36 | private String appKey = "f899139df5e1059396431415e770c6dd"; | 36 | private String appKey = "f899139df5e1059396431415e770c6dd"; |
37 | private GumpUser gumpUser; | 37 | private GumpUser gumpUser; |
38 | 38 | ||
39 | 39 | ||
40 | @Override | 40 | @Override |
41 | protected void onCreate(Bundle savedInstanceState) { | 41 | protected void onCreate(Bundle savedInstanceState) { |
42 | super.onCreate(savedInstanceState); | 42 | super.onCreate(savedInstanceState); |
43 | setContentView(R.layout.activity_main); | 43 | setContentView(R.layout.activity_main); |
44 | 44 | ||
45 | tvVersion = findViewById(R.id.version); | 45 | tvVersion = findViewById(R.id.version); |
46 | userInfo = findViewById(R.id.user_info); | 46 | userInfo = findViewById(R.id.user_info); |
47 | btnLoginOrLogout = findViewById(R.id.login_or_logout); | 47 | btnLoginOrLogout = findViewById(R.id.login_or_logout); |
48 | btnInit = findViewById(R.id.init); | 48 | btnInit = findViewById(R.id.init); |
49 | btnLoginOrLogout.setOnClickListener(new View.OnClickListener() { | 49 | btnLoginOrLogout.setOnClickListener(new View.OnClickListener() { |
50 | 50 | ||
51 | @Override | 51 | @Override |
52 | public void onClick(View v) { | 52 | public void onClick(View v) { |
53 | if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0) | 53 | if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0) |
54 | GumpSDK.start(MainActivity.this); | 54 | GumpSDK.start(MainActivity.this); |
55 | else | 55 | else |
56 | GumpSDK.logout(MainActivity.this); | 56 | GumpSDK.logout(MainActivity.this); |
57 | } | 57 | } |
58 | }); | 58 | }); |
59 | btnInit.setOnClickListener(new View.OnClickListener() { | 59 | btnInit.setOnClickListener(new View.OnClickListener() { |
60 | @Override | 60 | @Override |
61 | public void onClick(View v) { | 61 | public void onClick(View v) { |
62 | btnInit.setEnabled(false); | 62 | btnInit.setEnabled(false); |
63 | GumpSDK.init(getApplicationContext(), appId, appKey, "1000", new InitializeCallback() { | 63 | GumpSDK.init(getApplicationContext(), appId, appKey, "1000", new InitializeCallback() { |
64 | @Override | 64 | @Override |
65 | public void initComplete(int result) { | 65 | public void initComplete(int result) { |
66 | if (result == GumpSDK.CODE.OK) { | 66 | if (result == GumpSDK.CODE.OK) { |
67 | btnLoginOrLogout.setEnabled(true); | 67 | btnLoginOrLogout.setEnabled(true); |
68 | userInfo.setText("initialization has finished"); | 68 | userInfo.setText("initialization has finished"); |
69 | } else { | 69 | } else { |
70 | btnInit.setEnabled(true); | 70 | btnInit.setEnabled(true); |
71 | userInfo.setText("initialization has error"); | 71 | userInfo.setText("initialization has error"); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | }); | 74 | }); |
75 | } | 75 | } |
76 | }); | 76 | }); |
77 | findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() { | 77 | findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() { |
78 | 78 | ||
79 | @Override | 79 | @Override |
80 | public void onClick(View v) { | 80 | public void onClick(View v) { |
81 | Bundle payInfo = new Bundle(); | 81 | Bundle payInfo = new Bundle(); |
82 | payInfo.putString("product", "wa2"); | 82 | payInfo.putString("product", "wa2"); |
83 | payInfo.putFloat("amount", 0.1f); | 83 | payInfo.putFloat("amount", 0.1f); |
84 | payInfo.putString("extraInfo", "This is demo!"); | 84 | payInfo.putString("extraInfo", "This is demo!"); |
85 | payInfo.putString("serverId", "s1"); | 85 | payInfo.putString("serverId", "s1"); |
86 | payInfo.putString("roleId", "100123"); | 86 | payInfo.putString("roleId", "100123"); |
87 | payInfo.putString("sessionKey", gumpUser.getSessionKey().getToken()); | 87 | payInfo.putString("sessionKey", gumpUser.getSessionKey().getToken()); |
88 | GumpSDK.pay(MainActivity.this, payInfo, MainActivity.this); | 88 | GumpSDK.pay(MainActivity.this, payInfo, MainActivity.this); |
89 | } | 89 | } |
90 | }); | 90 | }); |
91 | findViewById(R.id.iap).setOnClickListener(new View.OnClickListener() { | 91 | findViewById(R.id.iap).setOnClickListener(new View.OnClickListener() { |
92 | @Override | 92 | @Override |
93 | public void onClick(View v) { | 93 | public void onClick(View v) { |
94 | Bundle payInfo = new Bundle(); | 94 | Bundle payInfo = new Bundle(); |
95 | payInfo.putString("product", "180010"); | 95 | payInfo.putString("product", "180010"); |
96 | payInfo.putFloat("amount", 0.1f); | 96 | payInfo.putFloat("amount", 0.1f); |
97 | payInfo.putString("extraInfo", "This is demo!"); | 97 | payInfo.putString("extraInfo", "This is demo!"); |
98 | payInfo.putString("serverId", "100"); | 98 | payInfo.putString("serverId", "100"); |
99 | payInfo.putString("roleId", "100123"); | 99 | payInfo.putString("roleId", "100123"); |
100 | GumpSDK.iap(MainActivity.this, payInfo, MainActivity.this); | 100 | GumpSDK.iap(MainActivity.this, payInfo, MainActivity.this); |
101 | } | 101 | } |
102 | }); | 102 | }); |
103 | 103 | ||
104 | 104 | ||
105 | Log.i("DEMO", "country:" + Locale.getDefault().getCountry() + ",language:" + Locale.getDefault().getLanguage()); | 105 | Log.i("DEMO", "country:" + Locale.getDefault().getCountry() + ",language:" + Locale.getDefault().getLanguage()); |
106 | 106 | ||
107 | GumpSDK.getSettings().setDebug(false); | 107 | GumpSDK.getSettings().setDebug(false); |
108 | /** | 108 | /** |
109 | * 设置是否打印debug日志 | 109 | * 设置是否打印debug日志 |
110 | */ | 110 | */ |
111 | GumpSDK.getSettings().enableDebugLogging(true); | 111 | GumpSDK.getSettings().enableDebugLogging(true); |
112 | /** | 112 | /** |
113 | * 设置启用facebook登录 | 113 | * 设置启用facebook登录 |
114 | */ | 114 | */ |
115 | GumpSDK.getSettings().requestThirdSupport(SDKSettings.THIRD_SUPPORT_FB); | 115 | GumpSDK.getSettings().requestThirdSupport(SDKSettings.THIRD_SUPPORT_FB); |
116 | /** | ||
117 | * 设置启用Vk登录 | ||
118 | */ | ||
119 | // GumpSDK.getSettings().requestThirdSupport(SDKSettings.THIRD_SUPPORT_VK); | ||
120 | |||
121 | 116 | ||
122 | /** | 117 | /** |
123 | * 设置启用google登录 | 118 | * 设置启用google登录 |
124 | */ | 119 | */ |
125 | GumpSDK.getSettings().requestThirdSupport(SDKSettings.THIRD_SUPPORT_GOOGLE); | 120 | GumpSDK.getSettings().requestThirdSupport(SDKSettings.THIRD_SUPPORT_GOOGLE); |
126 | 121 | ||
127 | /** | 122 | /** |
128 | * 设置启用Line登录 | 123 | * 设置启用Line登录 |
129 | */ | 124 | */ |
130 | GumpSDK.getSettings().requestThirdSupport(SDKSettings.THIRD_SUPPORT_LINE); | 125 | GumpSDK.getSettings().requestThirdSupport(SDKSettings.THIRD_SUPPORT_LINE); |
131 | /** | 126 | /** |
132 | * 设置屏幕方向 | 127 | * 设置屏幕方向 |
133 | */ | 128 | */ |
134 | GumpSDK.getSettings().setScreenLandscape(true); | 129 | GumpSDK.getSettings().setScreenLandscape(true); |
135 | 130 | ||
136 | /** | 131 | /** |
137 | * 设置支付版本 | 132 | * 设置支付版本 |
138 | */ | 133 | */ |
139 | GumpSDK.getSettings().setPaymentVersion(PaymentVersion.V4); | 134 | GumpSDK.getSettings().setPaymentVersion(PaymentVersion.V4); |
140 | 135 | ||
141 | /** | 136 | /** |
142 | * 设置用户登录状态监听器 | 137 | * 设置用户登录状态监听器 |
143 | */ | 138 | */ |
144 | 139 | ||
145 | GumpSDK.setUserStateListener(new LoginStateListener() { | 140 | GumpSDK.setUserStateListener(new LoginStateListener() { |
146 | @Override | 141 | @Override |
147 | public void onLoginSuccess(GumpUser user) { | 142 | public void onLoginSuccess(GumpUser user) { |
148 | gumpUser = user; | 143 | gumpUser = user; |
149 | String userType = null; | 144 | String userType = null; |
150 | switch (user.getAccountType()) { | 145 | switch (user.getAccountType()) { |
151 | case GumpPreference.ACCOUNT_TYPE_FB: | 146 | case GumpPreference.ACCOUNT_TYPE_FB: |
152 | userType = "Facebook登录"; | 147 | userType = "Facebook登录"; |
153 | String fbToken = FBAccessToken.getCurrentAccessToken().getToken(); | 148 | String fbToken = FBAccessToken.getCurrentAccessToken().getToken(); |
154 | Log.d(TAG, "FBAccessToken:" + fbToken); | 149 | Log.d(TAG, "FBAccessToken:" + fbToken); |
155 | break; | 150 | break; |
156 | case GumpPreference.ACCOUNT_TYPE_QUICK_REG: | 151 | case GumpPreference.ACCOUNT_TYPE_QUICK_REG: |
157 | userType = "快速登录"; | 152 | userType = "快速登录"; |
158 | break; | 153 | break; |
159 | case GumpPreference.ACCOUNT_TYPE_REG: | 154 | case GumpPreference.ACCOUNT_TYPE_REG: |
160 | userType = "gump注册用户"; | 155 | userType = "gump注册用户"; |
161 | break; | 156 | break; |
162 | case GumpPreference.ACCOUNT_TYPE_VK: | ||
163 | userType = "vk登录"; | ||
164 | break; | ||
165 | case GumpPreference.ACCOUNT_TYPE_GOOGLE: | 157 | case GumpPreference.ACCOUNT_TYPE_GOOGLE: |
166 | userType = "google 登录"; | 158 | userType = "google 登录"; |
167 | break; | 159 | break; |
168 | case GumpPreference.ACCOUNT_TYPE_LINE: | 160 | case GumpPreference.ACCOUNT_TYPE_LINE: |
169 | userType = "Line登录"; | 161 | userType = "Line登录"; |
170 | break; | 162 | break; |
171 | } | 163 | } |
172 | userInfo.setText(" Userid:" + user.getUid() + "\n accountType:(" + user.getAccountType() + ") " + userType + "\n sessionKey:" + user.getSessionKey() | 164 | userInfo.setText(" Userid:" + user.getUid() + "\n accountType:(" + user.getAccountType() + ") " + userType + "\n sessionKey:" + user.getSessionKey() |
173 | .getToken()); | 165 | .getToken()); |
174 | btnLoginOrLogout.setText("Logout"); | 166 | btnLoginOrLogout.setText("Logout"); |
175 | btnLoginOrLogout.setTag(1); | 167 | btnLoginOrLogout.setTag(1); |
176 | } | 168 | } |
177 | 169 | ||
178 | @Override | 170 | @Override |
179 | public void onLoginFailed(int code, String msg) { | 171 | public void onLoginFailed(int code, String msg) { |
180 | userInfo.setText(msg); | 172 | userInfo.setText(msg); |
181 | Toast.makeText(MainActivity.this, "Login failed:code=" + code + ",message=" + msg, Toast.LENGTH_SHORT).show(); | 173 | Toast.makeText(MainActivity.this, "Login failed:code=" + code + ",message=" + msg, Toast.LENGTH_SHORT).show(); |
182 | } | 174 | } |
183 | 175 | ||
184 | @Override | 176 | @Override |
185 | public void onLoginCanceled() { | 177 | public void onLoginCanceled() { |
186 | Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show(); | 178 | Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show(); |
187 | } | 179 | } |
188 | 180 | ||
189 | @Override | 181 | @Override |
190 | public void onLogout() { | 182 | public void onLogout() { |
191 | btnLoginOrLogout.setText("Login"); | 183 | btnLoginOrLogout.setText("Login"); |
192 | btnLoginOrLogout.setTag(0); | 184 | btnLoginOrLogout.setTag(0); |
193 | userInfo.setText("User is logout"); | 185 | userInfo.setText("User is logout"); |
194 | } | 186 | } |
195 | 187 | ||
196 | @Override | 188 | @Override |
197 | public void onPermissionDenied(String[] deniedPermissions) { | 189 | public void onPermissionDenied(String[] deniedPermissions) { |
198 | StringBuilder sb = new StringBuilder(); | 190 | StringBuilder sb = new StringBuilder(); |
199 | for (String s : deniedPermissions) { | 191 | for (String s : deniedPermissions) { |
200 | sb.append(s); | 192 | sb.append(s); |
201 | sb.append(","); | 193 | sb.append(","); |
202 | } | 194 | } |
203 | Toast.makeText(MainActivity.this, "Permission denied:" + sb.toString(), Toast.LENGTH_SHORT).show(); | 195 | Toast.makeText(MainActivity.this, "Permission denied:" + sb.toString(), Toast.LENGTH_SHORT).show(); |
204 | } | 196 | } |
205 | }); | 197 | }); |
206 | /** | 198 | /** |
207 | * 初始化sdk | 199 | * 初始化sdk |
208 | */ | 200 | */ |
209 | GumpSDK.init(getApplicationContext(), appId, appKey, "1000", new InitializeCallback() { | 201 | GumpSDK.init(getApplicationContext(), appId, appKey, "1000", new InitializeCallback() { |
210 | @Override | 202 | @Override |
211 | public void initComplete(int result) { | 203 | public void initComplete(int result) { |
212 | if (result == GumpSDK.CODE.OK) { | 204 | if (result == GumpSDK.CODE.OK) { |
213 | btnLoginOrLogout.setEnabled(true); | 205 | btnLoginOrLogout.setEnabled(true); |
214 | userInfo.setText("initialization has finished"); | 206 | userInfo.setText("initialization has finished"); |
215 | //checkRisk(); | 207 | //checkRisk(); |
216 | } else { | 208 | } else { |
217 | btnInit.setEnabled(true); | 209 | btnInit.setEnabled(true); |
218 | userInfo.setText("initialization has error"); | 210 | userInfo.setText("initialization has error"); |
219 | } | 211 | } |
220 | } | 212 | } |
221 | }); | 213 | }); |
222 | 214 | ||
223 | tvVersion.setText("SDK Version:" + GumpSDK.getVersion()); | 215 | tvVersion.setText("SDK Version:" + GumpSDK.getVersion()); |
224 | 216 | ||
225 | } | 217 | } |
226 | 218 | ||
227 | private void checkRisk() { | 219 | private void checkRisk() { |
228 | GumpSDK.checkRisk(this, new ResultCallback() { | 220 | GumpSDK.checkRisk(this, new ResultCallback() { |
229 | @Override | 221 | @Override |
230 | public void onResult(boolean isRisk) { | 222 | public void onResult(boolean isRisk) { |
231 | Log.i(TAG, isRisk ? "There is some risks" : "Nothing is risk"); | 223 | Log.i(TAG, isRisk ? "There is some risks" : "Nothing is risk"); |
232 | } | 224 | } |
233 | }); | 225 | }); |
234 | } | 226 | } |
235 | 227 | ||
236 | @Override | 228 | @Override |
237 | public void onPurchaseCompleted(PurchaseResult result) { | 229 | public void onPurchaseCompleted(PurchaseResult result) { |
238 | Log.i(TAG, "purchase completed"); | 230 | Log.i(TAG, "purchase completed"); |
239 | } | 231 | } |
240 | 232 | ||
241 | @Override | 233 | @Override |
242 | public void onPurchaseError(int code, String msg) { | 234 | public void onPurchaseError(int code, String msg) { |
243 | Log.i(TAG, "purchase error"); | 235 | Log.i(TAG, "purchase error"); |
244 | } | 236 | } |
245 | 237 | ||
246 | @Override | 238 | @Override |
247 | public void onPurchaseCanceled() { | 239 | public void onPurchaseCanceled() { |
248 | Log.i(TAG, "purchase canceled"); | 240 | Log.i(TAG, "purchase canceled"); |
249 | } | 241 | } |
250 | 242 | ||
251 | 243 | ||
252 | } | 244 | } |
253 | 245 |
README.md
1 | # Gump SDK 4 for Android接入文档 | 1 | # Gump SDK 4 for Android接入文档 |
2 | 2 | ||
3 | V4.5.8 | 3 | V4.6.2 |
4 | 2018年9月20日 | 4 | 2018年10月19日 |
5 | 5 | ||
6 | ## 版本概述 | 6 | ## 版本概述 |
7 | 7 | ||
8 | 此版本为使用AndroidStudio开发的版本,一改eclipse的工程依赖方式,使用aar的方式提供sdk接入包,除功能外,相对上一版本没有继承关系,请按此文档描述接入. | 8 | 此版本为使用AndroidStudio开发的版本,一改eclipse的工程依赖方式,使用aar的方式提供sdk接入包,除功能外,相对上一版本没有继承关系,请按此文档描述接入. |
9 | 9 | ||
10 | 此SDK适用android4.0以上系统. | 10 | 此SDK适用android4.0以上系统. |
11 | 11 | ||
12 | ## 第一章 接入指南 | 12 | ## 第一章 接入指南 |
13 | ### 1.依赖导入 | 13 | ### 1.依赖导入 |
14 | 配置gradle,以下为必须项 | 14 | 配置gradle,以下为必须项 |
15 | 15 | ||
16 | repositories{ | 16 | repositories{ |
17 | maven{ | 17 | maven{ |
18 | url "http://117.50.8.198:8081/nexus/content/repositories/sdk" | 18 | url "http://117.50.8.198:8081/nexus/content/repositories/sdk" |
19 | } | 19 | } |
20 | } | 20 | } |
21 | dependencies { | 21 | dependencies { |
22 | implementation 'com.gumptech.sdk:GameSDK:4.5.8' | 22 | implementation 'com.gumptech.sdk:GameSDK:4.6.2' |
23 | } | 23 | } |
24 | 24 | ||
25 | |||
26 | 可选接入vk登录时,需要导入vkLibrary工程,并配置模块依赖,如下 | ||
27 | |||
28 | implementation 'com.gumptech:VKsdk:1.5.4' | ||
29 | 25 | ||
30 | ### 2.修改AndroidManifest.xml文件 | 26 | ### 2.修改AndroidManifest.xml文件 |
31 | 首先添加必要的权限,如下所示: | 27 | 首先添加必要的权限,如下所示: |
32 | 28 | ||
33 | <uses-permission android:name="android.permission.INTERNET" /> | 29 | <uses-permission android:name="android.permission.INTERNET" /> |
34 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 30 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
35 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> | 31 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> |
36 | <!-- VERY IMPORTANT! Don't forget this permission, or in-app billing won't work. --> | 32 | <!-- VERY IMPORTANT! Don't forget this permission, or in-app billing won't work. --> |
37 | <uses-permission android:name="com.android.vending.BILLING" /> | 33 | <uses-permission android:name="com.android.vending.BILLING" /> |
38 | 34 | ||
39 | 其次注册相应的Activity,具体如下: | 35 | 其次注册相应的Activity,具体如下: |
40 | 36 | ||
41 | <activity | 37 | <activity |
42 | android:name="com.gumptech.sdk.ContainerActivity" | 38 | android:name="com.gumptech.sdk.ContainerActivity" |
43 | android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" | 39 | android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" |
44 | android:windowSoftInputMode="stateAlwaysHidden|adjustPan" | 40 | android:windowSoftInputMode="stateAlwaysHidden|adjustPan" |
45 | android:launchMode="singleTask" | 41 | android:launchMode="singleTask" |
46 | android:theme="@style/Theme.TransparentWin" > | 42 | android:theme="@style/Theme.TransparentWin" > |
47 | </activity> | 43 | </activity> |
48 | <activity | 44 | <activity |
49 | android:name="com.gumptech.sdk.PaymentActivity" | 45 | android:name="com.gumptech.sdk.PaymentActivity" |
50 | android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" | 46 | android:configChanges="orientation|screenSize|keyboardHidden|keyboard|screenLayout" |
51 | android:launchMode="singleTask" | 47 | android:launchMode="singleTask" |
52 | android:theme="@android:style/Theme.Translucent.NoTitleBar" > | 48 | android:theme="@android:style/Theme.Translucent.NoTitleBar" > |
53 | <intent-filter> | 49 | <intent-filter> |
54 | <category android:name="android.intent.category.DEFAULT" /> | 50 | <category android:name="android.intent.category.DEFAULT" /> |
55 | <action android:name="android.intent.action.VIEW" /> | 51 | <action android:name="android.intent.action.VIEW" /> |
56 | <category android:name="android.intent.category.BROWSABLE" /> | 52 | <category android:name="android.intent.category.BROWSABLE" /> |
57 | <data | 53 | <data |
58 | android:host="com.gump.sdk" | 54 | android:host="com.gump.sdk" |
59 | android:scheme="gump+游戏的appId" /> | 55 | android:scheme="gump+游戏的appId" /> |
60 | </intent-filter> | 56 | </intent-filter> |
61 | </activity> | 57 | </activity> |
62 | 58 | ||
63 | <!-- vk登录使用,若不接入vk,不需配置 --> | ||
64 | <activity android:name="com.vk.sdk.VKOpenAuthActivity" /> | ||
65 | <activity | ||
66 | android:name="com.vk.sdk.VKServiceActivity" | ||
67 | android:label="ServiceActivity" | ||
68 | android:theme="@style/VK.Transparent" /> | ||
69 | |||
70 | ### 3.向Gump平台索要游戏ID(AppID),完成代码接入 | 59 | ### 3.向Gump平台索要游戏ID(AppID),完成代码接入 |
71 | 正式开始接入逻辑代码前,先介绍下一些附加设置,以方便代码接入 | 60 | 正式开始接入逻辑代码前,先介绍下一些附加设置,以方便代码接入 |
72 | 61 | ||
73 | *是否打印debug日志 | 62 | *是否打印debug日志 |
74 | 63 | ||
75 | GumpSDK.getSettings().enableDebugLogging(true); | 64 | GumpSDK.getSettings().enableDebugLogging(true); |
76 | 65 | ||
77 | *横竖屏控制,默认为横屏,参数为false即为竖屏 | 66 | *横竖屏控制,默认为横屏,参数为false即为竖屏 |
78 | 67 | ||
79 | GumpSDK.getSettings().setScreenLandscape(true); | 68 | GumpSDK.getSettings().setScreenLandscape(true); |
80 | 69 | ||
81 | *设置需要启用的第三方登录,参数可选类型见第二章:[第三方登录平台](http://repository.gumptech.com:81/document/gamesdk4-android/blob/master/IntegrationGuide.md#1-third_plat) 字段说明 | 70 | *设置需要启用的第三方登录,参数可选类型见第二章:[第三方登录平台](http://repository.gumptech.com:81/document/gamesdk4-android/blob/master/IntegrationGuide.md#1-third_plat) 字段说明 |
82 | 71 | ||
83 | GumpSDK.getSettings().requestThirdSupport(SDKSettings.THIRD_SUPPORT_*); | 72 | GumpSDK.getSettings().requestThirdSupport(SDKSettings.THIRD_SUPPORT_*); |
84 | 73 | ||
85 | *若要使用V4版支付请设置 | 74 | *若要使用V4版支付请设置 |
86 | 75 | ||
87 | GumpSDK.getSettings().setPaymentVersion(PaymentVersion.V4); | 76 | GumpSDK.getSettings().setPaymentVersion(PaymentVersion.V4); |
88 | 77 | ||
89 | #### 1.调用GumpSDK前需要执行初始化。 | 78 | #### 1.调用GumpSDK前需要执行初始化。 |
90 | 79 | ||
91 | 若不需要分渠道 | 80 | 若不需要分渠道 |
92 | 81 | ||
93 | GumpSDK.init(Context,Appid, Appkey,InitializeCallback); | 82 | GumpSDK.init(Context,Appid, Appkey,InitializeCallback); |
94 | 如果需要定义渠道,必须使用如下方法 | 83 | 如果需要定义渠道,必须使用如下方法 |
95 | 84 | ||
96 | GumpSDK.init(Context,Appid, Appkey,ChannelId,InitializeCallback); | 85 | GumpSDK.init(Context,Appid, Appkey,ChannelId,InitializeCallback); |
97 | 86 | ||
98 | InitializeCallback为初始化回调接口,此接口只有一个回调方法initComplete(int result) result标识是否初始化成功,当result等于GumpSDK.CODE.OK时为成功,其他为失败 | 87 | InitializeCallback为初始化回调接口,此接口只有一个回调方法initComplete(int result) result标识是否初始化成功,当result等于GumpSDK.CODE.OK时为成功,其他为失败 |
99 | 88 | ||
100 | #### 2.调用GumpSDK的开始方法,将执行登录流程,需要一个Activity实例作参数 | 89 | #### 2.调用GumpSDK的开始方法,将执行登录流程,需要一个Activity实例作参数 |
101 | 90 | ||
102 | GumpSDK.start(Activity); | 91 | GumpSDK.start(Activity); |
103 | 在此之前,开发者需要注册用户状态监听以接受用户的登录/登出通知,通常如下: | 92 | 在此之前,开发者需要注册用户状态监听以接受用户的登录/登出通知,通常如下: |
104 | 93 | ||
105 | GumpSDK.setUserStateListener(new LoginStateListener() { | 94 | GumpSDK.setUserStateListener(new LoginStateListener() { |
106 | @Override | 95 | @Override |
107 | public void onLoginSuccess(GumpUser gumpUser) { | 96 | public void onLoginSuccess(GumpUser gumpUser) { |
108 | //登录成功,用户信息包含在GumpUser对象里 | 97 | //登录成功,用户信息包含在GumpUser对象里 |
109 | } | 98 | } |
110 | 99 | ||
111 | @Override | 100 | @Override |
112 | public void onLoginFailed(int code, String msg) { | 101 | public void onLoginFailed(int code, String msg) { |
113 | //登录出错,根据错误码和信息判断错误类型 | 102 | //登录出错,根据错误码和信息判断错误类型 |
114 | Toast.makeText(MainActivity.this, "Login failed:code="+code+",message="+msg, Toast.LENGTH_SHORT).show(); | 103 | Toast.makeText(MainActivity.this, "Login failed:code="+code+",message="+msg, Toast.LENGTH_SHORT).show(); |
115 | } | 104 | } |
116 | 105 | ||
117 | @Override | 106 | @Override |
118 | public void onLoginCanceled() { | 107 | public void onLoginCanceled() { |
119 | //用户取消登录 | 108 | //用户取消登录 |
120 | Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show(); | 109 | Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show(); |
121 | } | 110 | } |
122 | 111 | ||
123 | @Override | 112 | @Override |
124 | public void onLogout() { | 113 | public void onLogout() { |
125 | //用户登出 | 114 | //用户登出 |
126 | 115 | ||
127 | } | 116 | } |
128 | @Override | 117 | @Override |
129 | public void onPermissionDenied(String[] deniedPermissions) { | 118 | public void onPermissionDenied(String[] deniedPermissions) { |
130 | //用户未授予权限,参数为没有获取的权限 | 119 | //用户未授予权限,参数为没有获取的权限 |
131 | } | 120 | } |
132 | }); | 121 | }); |
133 | 122 | ||
134 | 如上成功登录后收到的GumpUser对象包含以下信息 | 123 | 如上成功登录后收到的GumpUser对象包含以下信息 |
135 | 124 | ||
136 | gumpUser.getUid();//获取用户的userid,此Id标识唯一用户! | 125 | gumpUser.getUid();//获取用户的userid,此Id标识唯一用户! |
137 | gumpUser.getAccountType();//用户类型,此类型数据可从GumpPreference常量获取 | 126 | gumpUser.getAccountType();//用户类型,此类型数据可从GumpPreference常量获取 |
138 | gumpUser.getSessionKey();//登录的sessionKey对象,获取sessionKey字符串请使用此对象的getToken()方法 | 127 | gumpUser.getSessionKey();//登录的sessionKey对象,获取sessionKey字符串请使用此对象的getToken()方法 |
139 | 128 | ||
140 | #### 3.支付功能 | 129 | #### 3.支付功能 |
141 | 1)使用gump通行证登录,其中除nick外所有参数为必传参数 | 130 | 1)使用gump通行证登录,其中除nick外所有参数为必传参数 |
142 | 131 | ||
143 | Bundle payInfo = new Bundle(); | 132 | Bundle payInfo = new Bundle(); |
144 | payInfo.putString("nick", "thi"); | 133 | payInfo.putString("nick", "thi"); |
145 | payInfo.putString("product", "元宝"); | 134 | payInfo.putString("product", "元宝"); |
146 | payInfo.putFloat("amount", 40.0f); | 135 | payInfo.putFloat("amount", 40.0f); |
147 | payInfo.putString("extraInfo", "This is demo!"); | 136 | payInfo.putString("extraInfo", "This is demo!"); |
148 | payInfo.putString("serverId", "B4003"); | 137 | payInfo.putString("serverId", "B4003"); |
149 | payInfo.putString("roleId", "10010"); | 138 | payInfo.putString("roleId", "10010"); |
150 | payInfo.putString("sessionKey","sessionkey"); | 139 | payInfo.putString("sessionKey","sessionkey"); |
151 | GumpSDK.pay(MainActivity.this, payInfo,PurchaseCallback); | 140 | GumpSDK.pay(MainActivity.this, payInfo,PurchaseCallback); |
152 | 调用pay方法时,必须穿入一个bundle对象,包含如上字段,除nick外所有字段必须全部包含,其中sessionKey为登录时返回的sessionKey | 141 | 调用pay方法时,必须穿入一个bundle对象,包含如上字段,除nick外所有字段必须全部包含,其中sessionKey为登录时返回的sessionKey |
153 | 142 | ||
154 | 143 | ||
155 | 2)IAP支付 | 144 | 2)IAP支付 |
156 | 145 | ||
157 | Bundle payInfo = new Bundle(); | 146 | Bundle payInfo = new Bundle(); |
158 | payInfo.putString("product", "gp_skuId"); | 147 | payInfo.putString("product", "gp_skuId"); |
159 | payInfo.putFloat("amount", 0.1f); | 148 | payInfo.putFloat("amount", 0.1f); |
160 | payInfo.putString("extraInfo", "This is demo!"); | 149 | payInfo.putString("extraInfo", "This is demo!"); |
161 | payInfo.putString("serverId", "100"); | 150 | payInfo.putString("serverId", "100"); |
162 | payInfo.putString("roleId","100123"); | 151 | payInfo.putString("roleId","100123"); |
163 | GumpSDK.iap(MainActivity.this, payInfo, PurchaseCallback); | 152 | GumpSDK.iap(MainActivity.this, payInfo, PurchaseCallback); |
164 | 153 | ||
165 | 3)PurchaseCallback为支付状态回调接口,此接口含有3个方法 | 154 | 3)PurchaseCallback为支付状态回调接口,此接口含有3个方法 |
166 | 155 | ||
167 | @Override | 156 | @Override |
168 | public void onPurchaseCompleted(PurchaseResult result) { | 157 | public void onPurchaseCompleted(PurchaseResult result) { |
169 | Log.i(TAG,"purchase completed"); | 158 | Log.i(TAG,"purchase completed"); |
170 | } | 159 | } |
171 | 160 | ||
172 | @Override | 161 | @Override |
173 | public void onPurchaseError(int code, String msg) { | 162 | public void onPurchaseError(int code, String msg) { |
174 | Log.i(TAG,"purchase error"); | 163 | Log.i(TAG,"purchase error"); |
175 | } | 164 | } |
176 | 165 | ||
177 | @Override | 166 | @Override |
178 | public void onPurchaseCanceled() { | 167 | public void onPurchaseCanceled() { |
179 | Log.i(TAG,"purchase canceled"); | 168 | Log.i(TAG,"purchase canceled"); |
180 | } | 169 | } |
181 | 170 | ||
182 | #### 4.注销登录 | 171 | #### 4.注销登录 |
183 | 172 | ||
184 | GumpSDK.logout(Activity); | 173 | GumpSDK.logout(Activity); |
185 | 当此方法调用后,用户退出登录,并会通过LoginStateListener接口通知调用程序!为了便于用户切换登录账户,请在游戏内提供用户注销的触发按钮 | 174 | 当此方法调用后,用户退出登录,并会通过LoginStateListener接口通知调用程序!为了便于用户切换登录账户,请在游戏内提供用户注销的触发按钮 |
186 | #### 5.运营开关接口,若需要接入,会有我方运营人员提出需求,否则不需要接入(若对此接口不知所云,即可认为不需要接入,请自行忽略) | 175 | #### 5.运营开关接口,若需要接入,会有我方运营人员提出需求,否则不需要接入(若对此接口不知所云,即可认为不需要接入,请自行忽略) |
187 | 176 | ||
188 | GumpSDK.checkRisk(this, new ResultCallback() { | 177 | GumpSDK.checkRisk(this, new ResultCallback() { |
189 | @Override | 178 | @Override |
190 | public void onResult(boolean result) { | 179 | public void onResult(boolean result) { |
191 | Log.i(TAG,result?"There is some risks":"Nothing is risk"); | 180 | Log.i(TAG,result?"There is some risks":"Nothing is risk"); |
192 | } | 181 | } |
193 | }); | 182 | }); |
194 | 183 | ||
195 | ## 第二章 常量字段与代码 | 184 | ## 第二章 常量字段与代码 |
196 | ### 1.第三方登录平台(third_plat) | 185 | ### 1.第三方登录平台(third_plat) |
197 | | 常量字段 | 说明 | | 186 | | 常量字段 | 说明 | |
198 | |--------------------------------|--------------| | 187 | |--------------------------------|--------------| |
199 | |SDKSettings.THIRD_SUPPORT_FB | Facebook登录 | | 188 | |SDKSettings.THIRD_SUPPORT_FB | Facebook登录 | |
200 | |SDKSettings.THIRD_SUPPORT_GOOGLE| Google登录 | | 189 | |SDKSettings.THIRD_SUPPORT_GOOGLE| Google登录 | |
201 | |SDKSettings.THIRD_SUPPORT_LINE | Line登录 | | 190 | |SDKSettings.THIRD_SUPPORT_LINE | Line登录 | |
202 | |SDKSettings.THIRD_SUPPORT_VK | VK登录 | | ||
203 | 191 | ||
204 | ### 2.登录账户类型 | 192 | ### 2.登录账户类型 |
205 | | 常量字段 | 说明 | | 193 | | 常量字段 | 说明 | |
206 | |-------------------------------------|--------------| | 194 | |-------------------------------------|--------------| |
207 | |GumpPreference.ACCOUNT_TYPE_FB | Facebook用户 | | 195 | |GumpPreference.ACCOUNT_TYPE_FB | Facebook用户 | |
208 | |GumpPreference.ACCOUNT_TYPE_REG | Gump注册用户 | | 196 | |GumpPreference.ACCOUNT_TYPE_REG | Gump注册用户 | |
209 | |GumpPreference.ACCOUNT_TYPE_QUICK_REG| 快速注册用户 | | 197 | |GumpPreference.ACCOUNT_TYPE_QUICK_REG| 游客 | |
210 | |GumpPreference.ACCOUNT_TYPE_GOOGLE | Google用户 | | 198 | |GumpPreference.ACCOUNT_TYPE_GOOGLE | Google用户 | |
211 | |GumpPreference.ACCOUNT_TYPE_LINE | Line用户 | | 199 | |GumpPreference.ACCOUNT_TYPE_LINE | Line用户 | |
212 | |GumpPreference.ACCOUNT_TYPE_VK | VK用户 | | 200 | |
213 | 201 | ||
214 | 202 | ||
215 | ## 第三章 常见问题 | 203 | ## 第三章 常见问题 |
216 | ### 问题1: 如何避免混淆对SDK的影响? | 204 | ### 问题1: 如何避免混淆对SDK的影响? |
217 | 解答:有些开发者对接入了SDK的程序进行混淆时,有可能会覆盖某些java | 205 | 解答:有些开发者对接入了SDK的程序进行混淆时,有可能会覆盖某些java |
218 | 类,导致SDK无法正常工作,解决方法如下: | 206 | 类,导致SDK无法正常工作,解决方法如下: |
219 | Ø 请开发者在混淆配置文件proguard.cfg或proguard-project.txt的最后加上 | 207 | Ø 请开发者在混淆配置文件proguard.cfg或proguard-project.txt的最后加上 |
220 | 208 | ||
221 | -keepattributes *Annotation*,InnerClasses,SourceFile,LineNumberTable | 209 | -keepattributes *Annotation*,InnerClasses,SourceFile,LineNumberTable |
222 | -keep public class * extends android.app.Service | 210 | -keep public class * extends android.app.Service |
223 | -keep public class com.google.vending.licensing.ILicensingService | 211 | -keep public class com.google.vending.licensing.ILicensingService |
224 | -keep public class com.android.vending.licensing.ILicensingService | 212 | -keep public class com.android.vending.licensing.ILicensingService |
225 | -keep class com.gumptech.sdk.view.* {*;} | 213 | -keep class com.gumptech.sdk.view.* {*;} |
226 | -keep class com.gumptech.sdk.web.* {*;} | 214 | -keep class com.gumptech.sdk.web.* {*;} |
227 | -keep class com.gumptech.sdk.bridge.impl.*{*;} | 215 | -keep class com.gumptech.sdk.bridge.impl.*{*;} |
228 | 216 | ||
229 | 217 | ||
230 | 使得混淆的时候不会影响SDK的命名空间。 | 218 | 使得混淆的时候不会影响SDK的命名空间。 |