Commit b0ad9130e16474486e8ab1ef585e137f7c18203f

Authored by 赵康
1 parent 409f1ffaa4
Exists in master

release3.3.2

修改自动登录时切换账号,使用vk有概率无法再登录的问题

Showing 6 changed files with 4 additions and 2 deletions Inline Diff

No preview for this file type
File was created 1
2 **/.DS_Store
3
android/GameSDKRelease/libs/GameSDK_v3.3.1_proguard.jar
No preview for this file type
android/GameSDKRelease/libs/GameSDK_v3.3.2_proguard.jar
No preview for this file type
android/GameSDKSample/src/com/gumptech/loginsdk/sample/MainActivity.java
1 package com.gumptech.loginsdk.sample; 1 package com.gumptech.loginsdk.sample;
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.GumpSDK; 11 import com.gumptech.sdk.GumpSDK;
12 import com.gumptech.sdk.bean.GumpUser; 12 import com.gumptech.sdk.bean.GumpUser;
13 import com.gumptech.sdk.bean.PurchaseResult; 13 import com.gumptech.sdk.bean.PurchaseResult;
14 import com.gumptech.sdk.callback.InitializeCallback; 14 import com.gumptech.sdk.callback.InitializeCallback;
15 import com.gumptech.sdk.callback.LoginStateListener; 15 import com.gumptech.sdk.callback.LoginStateListener;
16 import com.gumptech.sdk.callback.PurchaseCallback; 16 import com.gumptech.sdk.callback.PurchaseCallback;
17 import com.gumpsdk.wuruid.R; 17 import com.gumpsdk.wuruid.R;
18 18
19 public class MainActivity extends Activity implements PurchaseCallback{ 19 public class MainActivity extends Activity implements PurchaseCallback{
20 20
21 private static final String TAG = "MainActivity"; 21 private static final String TAG = "MainActivity";
22 22
23 private TextView tvVersion; 23 private TextView tvVersion;
24 private TextView userInfo; 24 private TextView userInfo;
25 25
26 private Button btnLoginOrLogout; 26 private Button btnLoginOrLogout;
27 27
28 private String appId = "10022"; 28 private String appId = "10022";
29 private String appKey = "93a27b0bd99bac3e68a440b48aa421ab"; 29 private String appKey = "93a27b0bd99bac3e68a440b48aa421ab";
30 30
31 @Override 31 @Override
32 protected void onCreate(Bundle savedInstanceState) { 32 protected void onCreate(Bundle savedInstanceState) {
33 super.onCreate(savedInstanceState); 33 super.onCreate(savedInstanceState);
34 setContentView(R.layout.activity_main); 34 setContentView(R.layout.activity_main);
35 tvVersion = (TextView) findViewById(R.id.version); 35 tvVersion = (TextView) findViewById(R.id.version);
36 userInfo = (TextView) findViewById(R.id.user_info); 36 userInfo = (TextView) findViewById(R.id.user_info);
37 btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout); 37 btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout);
38 btnLoginOrLogout.setOnClickListener(new View.OnClickListener() { 38 btnLoginOrLogout.setOnClickListener(new View.OnClickListener() {
39 39
40 @Override 40 @Override
41 public void onClick(View v) { 41 public void onClick(View v) {
42 if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0) 42 if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0)
43 GumpSDK.start(MainActivity.this); 43 GumpSDK.start(MainActivity.this);
44 else 44 else
45 GumpSDK.logout(MainActivity.this); 45 GumpSDK.logout(MainActivity.this);
46 } 46 }
47 }); 47 });
48 findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() { 48 findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() {
49 49
50 @Override 50 @Override
51 public void onClick(View v) { 51 public void onClick(View v) {
52 Bundle payInfo = new Bundle(); 52 Bundle payInfo = new Bundle();
53 payInfo.putString("nick", "thi"); 53 payInfo.putString("nick", "thi");
54 payInfo.putString("product", "元宝"); 54 payInfo.putString("product", "元宝");
55 payInfo.putFloat("amount", 0.0f); 55 payInfo.putFloat("amount", 0.0f);
56 payInfo.putString("extraInfo", "This is demo!"); 56 payInfo.putString("extraInfo", "This is demo!");
57 payInfo.putString("serverId", "103"); 57 payInfo.putString("serverId", "103");
58 GumpSDK.pay(MainActivity.this, payInfo, "6151046", MainActivity.this); 58 GumpSDK.pay(MainActivity.this, payInfo, "6151046", MainActivity.this);
59 } 59 }
60 }); 60 });
61 /** 61 /**
62 * 设置否是开启debug模式 62 * 设置否是开启debug模式
63 */ 63 */
64 GumpSDK.setDebugState(false); 64 GumpSDK.setDebugState(true);
65 /** 65 /**
66 * 设置是否启用facebook登录 66 * 设置是否启用facebook登录
67 */ 67 */
68 GumpSDK.setFBEnable(true); 68 GumpSDK.setFBEnable(true);
69 /** 69 /**
70 * 设置是否启用Vk登录 70 * 设置是否启用Vk登录
71 */ 71 */
72 GumpSDK.setVKEnable(false); 72 GumpSDK.setVKEnable(true);
73 /** 73 /**
74 * 设置屏幕方向 74 * 设置屏幕方向
75 */ 75 */
76 GumpSDK.setScreenLandscape(false); 76 GumpSDK.setScreenLandscape(false);
77 /** 77 /**
78 * 设置用户登录状态监听器 78 * 设置用户登录状态监听器
79 */ 79 */
80 GumpSDK.setUserStateListener(new LoginStateListener() { 80 GumpSDK.setUserStateListener(new LoginStateListener() {
81 @Override 81 @Override
82 public void onLoginSuccess(GumpUser user) { 82 public void onLoginSuccess(GumpUser user) {
83 userInfo.setText("Userid:" + user.getUid() + "\n accountType:" + user.getAccountType() + "\n sessionKey:" + user.getSessionKey()); 83 userInfo.setText("Userid:" + user.getUid() + "\n accountType:" + user.getAccountType() + "\n sessionKey:" + user.getSessionKey());
84 btnLoginOrLogout.setText("Logout"); 84 btnLoginOrLogout.setText("Logout");
85 btnLoginOrLogout.setTag(1); 85 btnLoginOrLogout.setTag(1);
86 } 86 }
87 87
88 @Override 88 @Override
89 public void onLoginFailed(int code, String msg) { 89 public void onLoginFailed(int code, String msg) {
90 userInfo.setText(msg); 90 userInfo.setText(msg);
91 Toast.makeText(MainActivity.this, "Login failed:code="+code+",message="+msg, Toast.LENGTH_SHORT).show(); 91 Toast.makeText(MainActivity.this, "Login failed:code="+code+",message="+msg, Toast.LENGTH_SHORT).show();
92 } 92 }
93 93
94 @Override 94 @Override
95 public void onLoginCanceled() { 95 public void onLoginCanceled() {
96 Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show(); 96 Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show();
97 } 97 }
98 98
99 @Override 99 @Override
100 public void onLogout() { 100 public void onLogout() {
101 btnLoginOrLogout.setText("Login"); 101 btnLoginOrLogout.setText("Login");
102 btnLoginOrLogout.setTag(0); 102 btnLoginOrLogout.setTag(0);
103 userInfo.setText("User is logout"); 103 userInfo.setText("User is logout");
104 } 104 }
105 }); 105 });
106 /** 106 /**
107 * 初始化sdk 107 * 初始化sdk
108 */ 108 */
109 GumpSDK.init(getApplicationContext(), appId, appKey, "1000", new InitializeCallback() { 109 GumpSDK.init(getApplicationContext(), appId, appKey, "1000", new InitializeCallback() {
110 @Override 110 @Override
111 public void initComplete(int result) { 111 public void initComplete(int result) {
112 if (result == GumpSDK.CODE.OK) { 112 if (result == GumpSDK.CODE.OK) {
113 btnLoginOrLogout.setEnabled(true); 113 btnLoginOrLogout.setEnabled(true);
114 } 114 }
115 } 115 }
116 }); 116 });
117 117
118 118
119 tvVersion.setText("SDK Version:" + GumpSDK.getVersion()); 119 tvVersion.setText("SDK Version:" + GumpSDK.getVersion());
120 } 120 }
121 121
122 @Override 122 @Override
123 public void onPurchaseCompleted(PurchaseResult result) { 123 public void onPurchaseCompleted(PurchaseResult result) {
124 Log.i(TAG,"purchase completed"); 124 Log.i(TAG,"purchase completed");
125 } 125 }
126 126
127 @Override 127 @Override
128 public void onPurchaseError(int code, String msg) { 128 public void onPurchaseError(int code, String msg) {
129 Log.i(TAG,"purchase error"); 129 Log.i(TAG,"purchase error");
130 } 130 }
131 131
132 @Override 132 @Override
133 public void onPurchaseCanceled() { 133 public void onPurchaseCanceled() {
134 Log.i(TAG,"purchase canceled"); 134 Log.i(TAG,"purchase canceled");
135 } 135 }
136 } 136 }
137 137
ios/.DS_Store
No preview for this file type