Commit 8609fd34c4454c202fb90de761bb2cd7786f47a3
1 parent
2f27694975
Exists in
master
升级到3.1.1版本
解决webview中js方法在4.4以上版本无效的问题 增加了easy2pay网页发送短信的实现
Showing 3 changed files with 5 additions and 6 deletions Inline Diff
android/GameSDKRelease/libs/GameSDK_v3.1.0_proguard.jar
No preview for this file type
android/GameSDKRelease/libs/GameSDK_v3.1.1_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.content.Intent; | 4 | import android.content.Intent; |
5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
6 | import android.util.Log; | 6 | import android.util.Log; |
7 | import android.view.View; | 7 | import android.view.View; |
8 | import android.widget.Button; | 8 | import android.widget.Button; |
9 | import android.widget.TextView; | 9 | import android.widget.TextView; |
10 | import android.widget.Toast; | 10 | import android.widget.Toast; |
11 | 11 | ||
12 | import com.gumptech.sdk.GumpSDK; | 12 | import com.gumptech.sdk.GumpSDK; |
13 | import com.loginsdk.sample.R; | 13 | import com.loginsdk.sample.R; |
14 | 14 | ||
15 | public class MainActivity extends Activity implements GumpSDK.Callback { | 15 | public class MainActivity extends Activity implements GumpSDK.Callback { |
16 | 16 | ||
17 | private TextView tvVersion; | 17 | private TextView tvVersion; |
18 | private TextView userInfo; | 18 | private TextView userInfo; |
19 | 19 | ||
20 | private Button btnLoginOrLogout; | 20 | private Button btnLoginOrLogout; |
21 | 21 | ||
22 | private String appId = "10022"; | 22 | private String appId = "10009"; |
23 | 23 | ||
24 | @Override | 24 | @Override |
25 | protected void onCreate(Bundle savedInstanceState) { | 25 | protected void onCreate(Bundle savedInstanceState) { |
26 | super.onCreate(savedInstanceState); | 26 | super.onCreate(savedInstanceState); |
27 | setContentView(R.layout.activity_main); | 27 | setContentView(R.layout.activity_main); |
28 | tvVersion = (TextView) findViewById(R.id.version); | 28 | tvVersion = (TextView) findViewById(R.id.version); |
29 | userInfo = (TextView) findViewById(R.id.user_info); | 29 | userInfo = (TextView) findViewById(R.id.user_info); |
30 | btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout); | 30 | btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout); |
31 | btnLoginOrLogout.setOnClickListener(new View.OnClickListener() { | 31 | btnLoginOrLogout.setOnClickListener(new View.OnClickListener() { |
32 | 32 | ||
33 | @Override | 33 | @Override |
34 | public void onClick(View v) { | 34 | public void onClick(View v) { |
35 | if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0) | 35 | if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0) |
36 | GumpSDK.start(MainActivity.this); | 36 | GumpSDK.start(MainActivity.this); |
37 | else | 37 | else |
38 | GumpSDK.logout(MainActivity.this, MainActivity.this); | 38 | GumpSDK.logout(MainActivity.this, MainActivity.this); |
39 | } | 39 | } |
40 | }); | 40 | }); |
41 | findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() { | 41 | findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() { |
42 | 42 | ||
43 | @Override | 43 | @Override |
44 | public void onClick(View v) { | 44 | public void onClick(View v) { |
45 | Bundle payInfo = new Bundle(); | 45 | Bundle payInfo = new Bundle(); |
46 | payInfo.putString("nick", "thi"); | 46 | payInfo.putString("nick", "thi"); |
47 | payInfo.putString("product", "元宝"); | 47 | payInfo.putString("product", "元宝"); |
48 | payInfo.putFloat("amount", 0.0f); | 48 | payInfo.putFloat("amount", 0.0f); |
49 | payInfo.putString("extraInfo", "This is demo!"); | 49 | payInfo.putString("extraInfo", "This is demo!"); |
50 | payInfo.putString("serverId", "5001"); | 50 | payInfo.putString("serverId", "4019"); |
51 | payInfo.putString("roleId", "41081"); | 51 | GumpSDK.pay(MainActivity.this, payInfo, "2263806"); |
52 | GumpSDK.pay(MainActivity.this, payInfo,"3332768"); | ||
53 | } | 52 | } |
54 | }); | 53 | }); |
55 | GumpSDK.init(getApplicationContext(), appId, "93a27b0bd99bac3e68a440b48aa421ab", "1000"); | 54 | GumpSDK.init(getApplicationContext(), appId, "483d8df877b31405c1e8fe4247f02d86", "1000"); |
56 | GumpSDK.setLogoShow(true); | 55 | GumpSDK.setLogoShow(true); |
57 | GumpSDK.setScreenLandscape(true); | 56 | GumpSDK.setScreenLandscape(false); |
58 | tvVersion.setText("SDK Version:" + GumpSDK.getVersion()); | 57 | tvVersion.setText("SDK Version:" + GumpSDK.getVersion()); |
59 | GumpSDK.start(this); | 58 | GumpSDK.start(this); |
60 | } | 59 | } |
61 | 60 | ||
62 | @Override | 61 | @Override |
63 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 62 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
64 | Log.d("Main", "activity requestCode:" + requestCode + ",resultCode:" + resultCode); | 63 | Log.d("Main", "activity requestCode:" + requestCode + ",resultCode:" + resultCode); |
65 | if (requestCode == GumpSDK.LOGIN_REQUEST_CODE) { | 64 | if (requestCode == GumpSDK.LOGIN_REQUEST_CODE) { |
66 | if (resultCode == RESULT_OK) { | 65 | if (resultCode == RESULT_OK) { |
67 | String uid = data.getStringExtra("userId"); | 66 | String uid = data.getStringExtra("userId"); |
68 | int accountType = data.getIntExtra("accountType", -1); | 67 | int accountType = data.getIntExtra("accountType", -1); |
69 | String sessionkey = data.getStringExtra("sessionKey"); | 68 | String sessionkey = data.getStringExtra("sessionKey"); |
70 | userInfo.setText(" userid:" + uid + "\n accountType:" + accountType + "\n sessionKey:" + sessionkey); | 69 | userInfo.setText(" userid:" + uid + "\n accountType:" + accountType + "\n sessionKey:" + sessionkey); |
71 | btnLoginOrLogout.setText("Logout"); | 70 | btnLoginOrLogout.setText("Logout"); |
72 | btnLoginOrLogout.setTag(1); | 71 | btnLoginOrLogout.setTag(1); |
73 | } else if (resultCode == RESULT_CANCELED) { | 72 | } else if (resultCode == RESULT_CANCELED) { |
74 | Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show(); | 73 | Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show(); |
75 | } | 74 | } |
76 | } | 75 | } |
77 | // @Deprecated | 76 | // @Deprecated |
78 | // else if (requestCode == GumpSDK.PAY_REQUEST_CODE) { | 77 | // else if (requestCode == GumpSDK.PAY_REQUEST_CODE) { |
79 | // if (resultCode == RESULT_OK) { | 78 | // if (resultCode == RESULT_OK) { |
80 | // int code = data.getIntExtra("code", -1); | 79 | // int code = data.getIntExtra("code", -1); |
81 | // String msg = data.getStringExtra("msg"); | 80 | // String msg = data.getStringExtra("msg"); |
82 | // String orderId = data.getStringExtra("orderId"); | 81 | // String orderId = data.getStringExtra("orderId"); |
83 | // String extraInfo = data.getStringExtra("extraInfo"); | 82 | // String extraInfo = data.getStringExtra("extraInfo"); |
84 | // Toast.makeText(this, "pay result: " + code + "," + msg + ",orderId:" + orderId + ",extraInfo:" + extraInfo, Toast.LENGTH_SHORT).show(); | 83 | // Toast.makeText(this, "pay result: " + code + "," + msg + ",orderId:" + orderId + ",extraInfo:" + extraInfo, Toast.LENGTH_SHORT).show(); |
85 | // } else if (resultCode == RESULT_CANCELED) { | 84 | // } else if (resultCode == RESULT_CANCELED) { |
86 | // Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show(); | 85 | // Toast.makeText(this, "operate be canceled", Toast.LENGTH_SHORT).show(); |
87 | // } | 86 | // } |
88 | // } | 87 | // } |
89 | super.onActivityResult(requestCode, resultCode, data); | 88 | super.onActivityResult(requestCode, resultCode, data); |
90 | } | 89 | } |
91 | 90 | ||
92 | @Override | 91 | @Override |
93 | public void onLogout() { | 92 | public void onLogout() { |
94 | btnLoginOrLogout.setText("Login"); | 93 | btnLoginOrLogout.setText("Login"); |
95 | btnLoginOrLogout.setTag(0); | 94 | btnLoginOrLogout.setTag(0); |
96 | userInfo.append("\n User is logout"); | 95 | userInfo.append("\n User is logout"); |
97 | } | 96 | } |
98 | 97 | ||
99 | } | 98 | } |
100 | 99 |