@@ -75,4 +75,10 @@ public abstract class SheepWXPayEntryActivity extends Activity implements IWXAPI
Jump2View.getInstance().goRechargeResult(this, result, frompackage, outorderno);
finish();
}
+
+ @Override
+ public void onDestroy(){
+ SheepApp.getInstance().getWxApi().detach();
+ super.onDestroy();
+ }
@@ -383,7 +383,7 @@ public class KFZSJs {
return;
String attach = jsonObject.getString("attach").split("_")[1];
- CommonUtil.getInstance().wxpay(SheepApp.getInstance().getWxApi(attach), jsonObject);
+ CommonUtil.getInstance().wxpay(SheepApp.getInstance().getWxApi(activity, attach), jsonObject);
@JavascriptInterface
@@ -179,7 +179,7 @@ public class ActPay extends BaseActivity {
QQUtil.saveWxPayOrderNo(SheepApp.getInstance(), jsonObject.getString("prepayid"), order_no);
+ CommonUtil.getInstance().wxpay(SheepApp.getInstance().getWxApi(ActPay.this, attach), jsonObject);
});
@@ -329,7 +329,7 @@ public class RechargeAct extends BaseActivity {
+ CommonUtil.getInstance().wxpay(SheepApp.getInstance().getWxApi(this, attach), jsonObject);
@@ -317,9 +317,9 @@ public class SheepApp extends MultiDexApplication {
return wxApi;
- public IWXAPI getWxApi(String flag) {
+ public IWXAPI getWxApi(Context context, String flag) {
String appid = "1".equals(flag) ? Config.WX_PAY_APP_ID : Config.WX_PAY_APP_ID2;
- wxApi = WXAPIFactory.createWXAPI(this, null);
+ wxApi = WXAPIFactory.createWXAPI(context, null);
// 将该app注册到微信
wxApi.registerApp(appid);