如题,搞了好久,还是没找到问题,APP支付成功了,点击返回商家,然后没走回调,但是log显示:
进入微信支付的log
03-28 15:02:16.671 1067-1651/? W/InterceptionReason: reason:6)finally, intercept as usual, interception = false details<>
03-28 15:02:16.672 1067-1651/? I/ActivityManager: START u0 {flg=0x10000 cmp=com.tencent.mm/.plugin.base.stub.WXPayEntryActivity (has extras)} from uid 10187 on display 0
最后出现一条LOG
03-28 15:17:37.042 30014-30014/? W/MicroMsg.SDK.WXApiImplV10: context is not instanceof Activity or Service, disable WXStat
不太懂什么意思
这里是支付完成后的log
03-28 15:02:38.763 1067-1131/? W/InterceptionReason: reason:6)finally, intercept as usual, interception = false details<>
03-28 15:02:38.764 1067-1131/? I/ActivityManager: START u0 {flg=0x10000000 cmp=com.hc.house/.wxapi.WXPayEntryActivity (has extras)} from uid 10113 on display 0
但是就是没进入WXPayEntryActivity,奇怪的是取消支付就正常走业务了,
配置:
<!-- wxpay -->
android:name=".wxapi.WXPayEntryActivity"
android:exported="true"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
项目结构:
WXPayEntryActivity:
/支付成功回调页
public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {
private IWXAPI api;
static int payType=-1;//标识
public static Handler Typehandler=new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
payType=msg.what; //获取支付类型
Log.e("微信支付 ","当前获取类型 "+payType);
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
api = WXAPIFactory.createWXAPI(WXPayEntryActivity.this,HmApplication.WXAPPID);
api.handleIntent(getIntent(), WXPayEntryActivity.this);
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
api.handleIntent(intent,WXPayEntryActivity.this);
}
@Override
public void onReq(BaseReq baseReq) {
Log.e("微信支付 ","进入支付回调页onReq "+payType);
}
@Override
public void onResp(BaseResp baseResp) {
Log.e("微信支付 ","进入支付回调页onResp "+payType +" 支付完成code "+baseResp.errCode);
if (baseResp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
if(baseResp.errCode==-1){
setPayResult("支付失败");
}
if(baseResp.errCode==0){
setPayResult("支付完成");
}
if(baseResp.errCode==-2){
setPayResult("取消支付");
}
}
}
private void setPayResult(String msg){
HmToast.show(WXPayEntryActivity.this,msg,300);
finish();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
}