Commit d295d09fc837e1a770d3f953dad06b22efd3dbe1

Authored by 赵康
Exists in master

Merge branch 'master' of http://123.59.74.8/document/gumptech-document

Showing 7 changed files Side-by-side Diff

android/GameSDKRelease/libs/GameSDK_v3.3.4_proguard.jar
No preview for this file type
android/GameSDKRelease/libs/GameSDK_v3.3.5_proguard.jar
No preview for this file type
android/GameSDKRelease/res/layout/pay_container.xml
... ... @@ -5,12 +5,22 @@
5 5 android:background="@color/payment_common_bg"
6 6 android:orientation="vertical" >
7 7  
8   - <LinearLayout
9   - android:id="@+id/container"
  8 + <ProgressBar
  9 + android:id="@+id/loading_prog"
  10 + style="@android:style/Widget.ProgressBar.Horizontal"
10 11 android:layout_width="match_parent"
11   - android:layout_height="wrap_content"
12   - android:orientation="vertical" >
13   -
14   - </LinearLayout>
  12 + android:layout_height="2dp" />
  13 +
  14 + <WebView
  15 + android:id="@+id/mycard_web"
  16 + android:layout_width="fill_parent"
  17 + android:layout_height="fill_parent" />
  18 +
  19 +<!-- <LinearLayout -->
  20 +<!-- android:id="@+id/container" -->
  21 +<!-- android:layout_width="match_parent" -->
  22 +<!-- android:layout_height="wrap_content" -->
  23 +<!-- android:orientation="vertical" > -->
  24 +<!-- </LinearLayout> -->
15 25  
16 26 </LinearLayout>
17 27 \ No newline at end of file
android/GameSDKSample/project.properties
... ... @@ -12,5 +12,5 @@
12 12  
13 13 # Project target.
14 14  
15   -target=android-22
16   -android.library.reference.1=../GameSDKRelease
  15 +target=android-21
  16 +android.library.reference.1=../../../../gamesdk/GameSDK
android/GameSDKSample/src/com/gumptech/loginsdk/sample/MainActivity.java
1   -package com.gumptech.loginsdk.sample;
2   -
3   -import android.app.Activity;
4   -import android.content.Context;
5   -import android.os.Bundle;
6   -import android.text.ClipboardManager;
7   -import android.util.Log;
8   -import android.view.View;
9   -import android.widget.Button;
10   -import android.widget.TextView;
11   -import android.widget.Toast;
12   -
13   -import com.gumptech.sdk.GumpPreference;
14   -import com.gumptech.sdk.GumpSDK;
15   -import com.gumptech.sdk.bean.GumpUser;
16   -import com.gumptech.sdk.bean.PurchaseResult;
17   -import com.gumptech.sdk.callback.InitializeCallback;
18   -import com.gumptech.sdk.callback.LoginStateListener;
19   -import com.gumptech.sdk.callback.PurchaseCallback;
20   -import com.gumpsdk.wuruid.R;
21   -
22   -public class MainActivity extends Activity implements PurchaseCallback{
23   -
24   - private static final String TAG = "MainActivity";
25   -
26   - private TextView tvVersion;
27   - private TextView userInfo;
28   -
29   - private Button btnLoginOrLogout;
30   -
31   - private String appId = "10022";
32   - private String appKey = "93a27b0bd99bac3e68a440b48aa421ab";
33   -
34   - @Override
35   - protected void onCreate(Bundle savedInstanceState) {
36   - super.onCreate(savedInstanceState);
37   - setContentView(R.layout.activity_main);
38   - tvVersion = (TextView) findViewById(R.id.version);
39   - userInfo = (TextView) findViewById(R.id.user_info);
40   - btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout);
41   - btnLoginOrLogout.setOnClickListener(new View.OnClickListener() {
42   -
43   - @Override
44   - public void onClick(View v) {
45   - if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0)
46   - GumpSDK.start(MainActivity.this);
47   - else
48   - GumpSDK.logout(MainActivity.this);
49   - }
50   - });
51   - findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() {
52   -
53   - @Override
54   - public void onClick(View v) {
55   - Bundle payInfo = new Bundle();
56   - payInfo.putString("nick", "thi");
57   - payInfo.putString("product", "元宝");
58   - payInfo.putFloat("amount", 0.0f);
59   - payInfo.putString("extraInfo", "This is demo!");
60   - payInfo.putString("serverId", "5025");
61   - GumpSDK.pay(MainActivity.this, payInfo, "7798753", MainActivity.this);
62   - }
63   - });
64   - /**
65   - * 设置否是开启debug模式
66   - */
67   - GumpSDK.setDebugState(true);
68   - /**
69   - * 设置是否启用facebook登录
70   - */
71   - GumpSDK.setFBEnable(true);
72   - /**
73   - * 设置是否启用Vk登录
74   - */
75   - GumpSDK.setVKEnable(true);
76   - /**
77   - * 设置屏幕方向
78   - */
79   - GumpSDK.setScreenLandscape(false);
80   - /**
81   - * 设置用户登录状态监听器
82   - */
83   - GumpSDK.setUserStateListener(new LoginStateListener() {
84   - @Override
85   - public void onLoginSuccess(GumpUser user) {
86   - ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
87   - cm.setText(user.getSessionKey());
88   -
89   - String userType=null;
90   - switch(user.getAccountType()){
91   - case GumpPreference.ACCOUNT_TYPE_FB:
92   - userType = "Facebook登录";
93   - break;
94   - case GumpPreference.ACCOUNT_TYPE_QUICK_REG:
95   - userType = "快速登录";
96   - break;
97   - case GumpPreference.ACCOUNT_TYPE_REG:
98   - userType = "gump注册用户";
99   - break;
100   - case GumpPreference.ACCOUNT_TYPE_VK:
101   - userType = "vk登录";
102   - break;
103   - }
104   - userInfo.setText(" Userid:" + user.getUid() + "\n accountType:(" + user.getAccountType()+") "+userType + "\n sessionKey:" + user.getSessionKey());
105   - btnLoginOrLogout.setText("Logout");
106   - btnLoginOrLogout.setTag(1);
107   - }
108   -
109   - @Override
110   - public void onLoginFailed(int code, String msg) {
111   - userInfo.setText(msg);
112   - Toast.makeText(MainActivity.this, "Login failed:code="+code+",message="+msg, Toast.LENGTH_SHORT).show();
113   - }
114   -
115   - @Override
116   - public void onLoginCanceled() {
117   - Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show();
118   - }
119   -
120   - @Override
121   - public void onLogout() {
122   - btnLoginOrLogout.setText("Login");
123   - btnLoginOrLogout.setTag(0);
124   - userInfo.setText("User is logout");
125   - }
126   - });
127   - /**
128   - * 初始化sdk
129   - */
130   - GumpSDK.init(getApplicationContext(), appId, appKey, "1000", new InitializeCallback() {
131   - @Override
132   - public void initComplete(int result) {
133   - if (result == GumpSDK.CODE.OK) {
134   - btnLoginOrLogout.setEnabled(true);
135   - }
136   - }
137   - });
138   -
139   -
140   - tvVersion.setText("SDK Version:" + GumpSDK.getVersion());
141   - }
142   -
143   - @Override
144   - public void onPurchaseCompleted(PurchaseResult result) {
145   - Log.i(TAG,"purchase completed");
146   - }
147   -
148   - @Override
149   - public void onPurchaseError(int code, String msg) {
150   - Log.i(TAG,"purchase error");
151   - }
152   -
153   - @Override
154   - public void onPurchaseCanceled() {
155   - Log.i(TAG,"purchase canceled");
156   - }
157   -}
  1 +package com.gumptech.loginsdk.sample;
  2 +
  3 +import android.app.Activity;
  4 +import android.content.Context;
  5 +import android.os.Bundle;
  6 +import android.text.ClipboardManager;
  7 +import android.util.Log;
  8 +import android.view.View;
  9 +import android.widget.Button;
  10 +import android.widget.TextView;
  11 +import android.widget.Toast;
  12 +
  13 +import com.gumptech.sdk.GumpPreference;
  14 +import com.gumptech.sdk.GumpSDK;
  15 +import com.gumptech.sdk.bean.GumpUser;
  16 +import com.gumptech.sdk.bean.PurchaseResult;
  17 +import com.gumptech.sdk.callback.InitializeCallback;
  18 +import com.gumptech.sdk.callback.LoginStateListener;
  19 +import com.gumptech.sdk.callback.PurchaseCallback;
  20 +import com.gumpsdk.wuruid.R;
  21 +
  22 +public class MainActivity extends Activity implements PurchaseCallback{
  23 +
  24 + private static final String TAG = "MainActivity";
  25 +
  26 + private TextView tvVersion;
  27 + private TextView userInfo;
  28 +
  29 + private Button btnLoginOrLogout;
  30 +
  31 + private String appId = "10022";
  32 + private String appKey = "93a27b0bd99bac3e68a440b48aa421ab";
  33 + private String sessionKey;
  34 +
  35 + @Override
  36 + protected void onCreate(Bundle savedInstanceState) {
  37 + super.onCreate(savedInstanceState);
  38 + setContentView(R.layout.activity_main);
  39 + tvVersion = (TextView) findViewById(R.id.version);
  40 + userInfo = (TextView) findViewById(R.id.user_info);
  41 + btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout);
  42 + btnLoginOrLogout.setOnClickListener(new View.OnClickListener() {
  43 +
  44 + @Override
  45 + public void onClick(View v) {
  46 + if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0)
  47 + GumpSDK.start(MainActivity.this);
  48 + else
  49 + GumpSDK.logout(MainActivity.this);
  50 + }
  51 + });
  52 + findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() {
  53 +
  54 + @Override
  55 + public void onClick(View v) {
  56 + Bundle payInfo = new Bundle();
  57 + payInfo.putString("nick", "thi");
  58 + payInfo.putString("product", "元宝");
  59 + payInfo.putFloat("amount", 0.0f);
  60 + payInfo.putString("extraInfo", "This is demo!");
  61 + payInfo.putString("serverId", "100");
  62 + payInfo.putString("sessionKey", sessionKey);
  63 + GumpSDK.pay(MainActivity.this, payInfo, MainActivity.this);
  64 + }
  65 + });
  66 + /**
  67 + * 设置否是开启debug模式
  68 + */
  69 + GumpSDK.setDebugState(false);
  70 + /**
  71 + * 设置是否启用facebook登录
  72 + */
  73 + GumpSDK.setFBEnable(true);
  74 + /**
  75 + * 设置是否启用Vk登录
  76 + */
  77 + GumpSDK.setVKEnable(true);
  78 + /**
  79 + * 设置屏幕方向
  80 + */
  81 + GumpSDK.setScreenLandscape(true);
  82 + /**
  83 + * 设置用户登录状态监听器
  84 + */
  85 + GumpSDK.setUserStateListener(new LoginStateListener() {
  86 + @Override
  87 + public void onLoginSuccess(GumpUser user) {
  88 + ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
  89 + cm.setText(user.getSessionKey());
  90 + sessionKey = user.getSessionKey();
  91 + String userType=null;
  92 + switch(user.getAccountType()){
  93 + case GumpPreference.ACCOUNT_TYPE_FB:
  94 + userType = "Facebook登录";
  95 + break;
  96 + case GumpPreference.ACCOUNT_TYPE_QUICK_REG:
  97 + userType = "快速登录";
  98 + break;
  99 + case GumpPreference.ACCOUNT_TYPE_REG:
  100 + userType = "gump注册用户";
  101 + break;
  102 + case GumpPreference.ACCOUNT_TYPE_VK:
  103 + userType = "vk登录";
  104 + break;
  105 + }
  106 + userInfo.setText(" Userid:" + user.getUid() + "\n accountType:(" + user.getAccountType()+") "+userType + "\n sessionKey:" + user.getSessionKey());
  107 + btnLoginOrLogout.setText("Logout");
  108 + btnLoginOrLogout.setTag(1);
  109 + }
  110 +
  111 + @Override
  112 + public void onLoginFailed(int code, String msg) {
  113 + userInfo.setText(msg);
  114 + Toast.makeText(MainActivity.this, "Login failed:code="+code+",message="+msg, Toast.LENGTH_SHORT).show();
  115 + }
  116 +
  117 + @Override
  118 + public void onLoginCanceled() {
  119 + Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show();
  120 + }
  121 +
  122 + @Override
  123 + public void onLogout() {
  124 + btnLoginOrLogout.setText("Login");
  125 + btnLoginOrLogout.setTag(0);
  126 + userInfo.setText("User is logout");
  127 + }
  128 + });
  129 + /**
  130 + * 初始化sdk
  131 + */
  132 + GumpSDK.init(getApplicationContext(), appId, appKey, "1000", new InitializeCallback() {
  133 + @Override
  134 + public void initComplete(int result) {
  135 + if (result == GumpSDK.CODE.OK) {
  136 + btnLoginOrLogout.setEnabled(true);
  137 + }
  138 + }
  139 + });
  140 +
  141 +
  142 + tvVersion.setText("SDK Version:" + GumpSDK.getVersion());
  143 + }
  144 +
  145 + @Override
  146 + public void onPurchaseCompleted(PurchaseResult result) {
  147 + Log.i(TAG,"purchase completed");
  148 + }
  149 +
  150 + @Override
  151 + public void onPurchaseError(int code, String msg) {
  152 + Log.i(TAG,"purchase error");
  153 + }
  154 +
  155 + @Override
  156 + public void onPurchaseCanceled() {
  157 + Log.i(TAG,"purchase canceled");
  158 + }
  159 +}
doc/AndroidDocument.md
... ... @@ -2,8 +2,8 @@
2 2  
3 3  
4 4 接入手册
5   -V 3.3.4
6   -2016年01月22日
  5 +V 3.3.5
  6 +2016年03月04日
7 7  
8 8 快速入口:
9 9 [支付部分服务端回调文档](http://git.letsgame.mobi/document/gumptech-document/blob/master/doc/ServerDocument.md)
... ... @@ -170,7 +170,7 @@ InitializeCallback为初始化回调接口,此接口只有一个回调方法init
170 170  
171 171  
172 172 3.支付功能
173   - 1)使用gump通行证登录,其中除nick外所有参数为必传参数
  173 + 1)使用gump通行证登录,其中除nick和roleId外所有参数为必传参数
174 174  
175 175 Bundle payInfo = new Bundle();
176 176 payInfo.putString("nick", "thi");
... ... @@ -179,9 +179,10 @@ InitializeCallback为初始化回调接口,此接口只有一个回调方法init
179 179 payInfo.putString("extraInfo", "This is demo!");
180 180 payInfo.putString("serverId", "B4003");
181 181 payInfo.putString("roleId", "10010");
  182 + payInfo.putString("sessionKey","sessionkey");
182 183 GumpSDK.pay(MainActivity.this, payInfo,PurchaseCallback);
183   -调用pay方法时,必须穿入一个bundle对象,包含如上字段,除nick外所有字段必须全部包含
184   - 2)未使用gump通行证登录,需要传入用户id
  184 +调用pay方法时,必须穿入一个bundle对象,包含如上字段,除nick和roleId外所有字段必须全部包含,其中sessionKey为登录时返回的sessionKey
  185 + 2)未使用gump通行证登录,需要传入用户id,同时sessionKey不再需要
185 186  
186 187 Bundle payInfo = new Bundle();
187 188 payInfo.putString("nick", "thi");
... ... @@ -60,6 +60,9 @@ GumpTech页面支付(已集成到sdk中,可忽略)
60 60  
61 61 统一支付: http://api.gumptech.com/v2/p/index.do
62 62 横版: http://api.gumptech.com/v2/wide/p/index.do
  63 +
  64 + 横版V3: http://api.gumptech.com/v3/wide/p/index.do(引入Gump币支付)
  65 +
63 66 需要传入参数:
64 67 1. appId: 必选参数 接入前GumpTeck分配的应用id
65 68 2. userId: 必选参数 GumpTech平台的用户id
... ... @@ -68,6 +71,8 @@ GumpTech页面支付(已集成到sdk中,可忽略)
68 71 5. product: 必选参数 第三方传入,购买物品
69 72 6. amount: 可选参数 第三方传入,购买物品所需要的金额(点数)
70 73  
  74 + 7.sessionKey: V3版本必选 登录获取的sessionKey,支付使用
  75 +
71 76 以下参数需要在服务端配置,需要研发商联系接口人配置:
72 77 1. queryRoleUrl: 支付页面显示服务器列表 参考【第三方查询角色接口】
73 78 2. querySeversUrl: 查询用户角色 格式参考【第三方查询区服列表接口】
74 79 \ No newline at end of file