微信回调Activity更改
This commit is contained in:
@@ -471,7 +471,7 @@
|
||||
<!-- tools:node="merge" />-->
|
||||
<!-- 为了兼容小程序返回的问题,声明WXEntryActivity,并把之前的 WechatHandlerActivity注释 -->
|
||||
<activity
|
||||
android:name="com.mango.yinyou.wxapi.WXPayEntryActivity"
|
||||
android:name="com.mango.yinyou.wxapi.WXEntryActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:exported="true" />
|
||||
|
||||
|
@@ -0,0 +1,25 @@
|
||||
package com.mango.yinyou.wxapi;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import cn.sharesdk.wechat.utils.WXMediaMessage;
|
||||
import cn.sharesdk.wechat.utils.WechatHandlerActivity;
|
||||
|
||||
/**
|
||||
* create by lvzebiao @2019/11/8
|
||||
*/
|
||||
public class WXEntryActivity extends WechatHandlerActivity {
|
||||
|
||||
@Override
|
||||
public void onShowMessageFromWXReq(WXMediaMessage msg) {
|
||||
super.onShowMessageFromWXReq(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetMessageFromWXReq(WXMediaMessage msg) {
|
||||
super.onGetMessageFromWXReq(msg);
|
||||
//从小程序返回APP
|
||||
Intent iLaunchMyself = getPackageManager().getLaunchIntentForPackage(getPackageName());
|
||||
startActivity(iLaunchMyself);
|
||||
}
|
||||
}
|
@@ -1,58 +0,0 @@
|
||||
package com.mango.yinyou.wxapi;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.mm.opensdk.constants.ConstantsAPI;
|
||||
import com.tencent.mm.opensdk.modelbase.BaseReq;
|
||||
import com.tencent.mm.opensdk.modelbase.BaseResp;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
|
||||
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.pay.PaymentActivity;
|
||||
|
||||
public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {
|
||||
|
||||
private static final String TAG = "WXPayEntryActivity";
|
||||
|
||||
private IWXAPI api;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
api = WXAPIFactory.createWXAPI(this, XChatConstants.WX_APP_ID);
|
||||
api.handleIntent(getIntent(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
api.handleIntent(intent, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReq(BaseReq req) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResp(BaseResp baseResp) {
|
||||
|
||||
Log.e(TAG, "onPayFinish, errCode = " + baseResp.errCode + ", errorStr = " + baseResp.errStr);
|
||||
|
||||
if (baseResp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
|
||||
Intent intent = new Intent(this, PaymentActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user