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