|
|
@@ -1,57 +1,57 @@
|
|
|
-package com.thinkive.sidiinfo.sng.wxapi;
|
|
|
-import com.thinkive.limitup.android.common.Constants;
|
|
|
-import com.thinkive.sidiinfo.sng.R;
|
|
|
-import com.tencent.mm.sdk.constants.ConstantsAPI;
|
|
|
+package com.xzjmyk.pm.activity.wxapi;
|
|
|
+
|
|
|
+import android.app.Activity;
|
|
|
+import android.content.Intent;
|
|
|
+import android.os.Bundle;
|
|
|
+
|
|
|
+import com.core.app.Constants;
|
|
|
+import com.tencent.mm.opensdk.constants.ConstantsAPI;
|
|
|
import com.tencent.mm.sdk.modelbase.BaseReq;
|
|
|
import com.tencent.mm.sdk.modelbase.BaseResp;
|
|
|
import com.tencent.mm.sdk.openapi.IWXAPI;
|
|
|
import com.tencent.mm.sdk.openapi.IWXAPIEventHandler;
|
|
|
import com.tencent.mm.sdk.openapi.WXAPIFactory;
|
|
|
-import android.app.Activity;
|
|
|
-import android.content.Intent;
|
|
|
-import android.os.Bundle;
|
|
|
|
|
|
-public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler{
|
|
|
-
|
|
|
+public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {
|
|
|
private IWXAPI api;
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
- setContentView(R.layout.pay_result);
|
|
|
- api = WXAPIFactory.createWXAPI(this, Constants.wxAppId);
|
|
|
+// setContentView(R.layout.pay_result);
|
|
|
+ api = WXAPIFactory.createWXAPI(this, Constants.WXPAY_APPID);
|
|
|
api.handleIntent(getIntent(), this);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- protected void onNewIntent(Intent intent) {
|
|
|
- super.onNewIntent(intent);
|
|
|
- setIntent(intent);
|
|
|
+ @Override
|
|
|
+ protected void onNewIntent(Intent intent) {
|
|
|
+ super.onNewIntent(intent);
|
|
|
+ setIntent(intent);
|
|
|
api.handleIntent(intent, this);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onReq(BaseReq req) {
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onResp(BaseResp resp) {
|
|
|
-
|
|
|
- // 0 支付成功
|
|
|
- // -2取消
|
|
|
- if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onReq(BaseReq req) {
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onResp(BaseResp resp) {
|
|
|
+
|
|
|
+ // 0 支付成功
|
|
|
+ // -2取消
|
|
|
+ if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
|
|
|
// AlertDiaWedroidLog.Builder builder = new AlertDiaWedroidLog.Builder(this);
|
|
|
// builder.setTitle(R.string.app_tip);
|
|
|
// builder.setMessage(getString(R.string.pay_result_callback_msg, String.valueOf(resp.errCode)));
|
|
|
// builder.show();
|
|
|
- Intent mIntent = new Intent("wxpay");
|
|
|
- if(resp.errCode == 0){
|
|
|
- mIntent.putExtra("result", true);
|
|
|
- }else{
|
|
|
- mIntent.putExtra("result", false);
|
|
|
- }
|
|
|
- sendBroadcast(mIntent);
|
|
|
- }
|
|
|
- finish();
|
|
|
- }
|
|
|
+ Intent mIntent = new Intent("wxpay");
|
|
|
+ if (resp.errCode == 0) {
|
|
|
+ mIntent.putExtra("result", true);
|
|
|
+ } else {
|
|
|
+ mIntent.putExtra("result", false);
|
|
|
+ }
|
|
|
+ sendBroadcast(mIntent);
|
|
|
+ }
|
|
|
+ finish();
|
|
|
+ }
|
|
|
}
|