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