android 微信小程序 唤起app,Android 微信小程序打不开app方案解决
以前一直困擾著app跳轉(zhuǎn)小程序以后,小程序中沒法喚起APP了,并且的響應(yīng)信息也沒有,終于結(jié)合多方案解決這個問題。小程序
1,manifest中必定要這么寫api
2,WXEntryActivity必需要放指定路徑,并且位于包名下,就是com.xxxx.xxx.wxapi.WXEntryActivityapp
這里有兩個問題注意,要加上taskAffinity你的包名,launchMode要加上,WXEntryActivity必需要在包名下的固定位置,不然都沒法接收到小程序的BaseResp給你的信息,this
if (baseResp.getType() == ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM) {
// WXLaunchMiniProgram.Resp launchMiniProResp = (WXLaunchMiniProgram.Resp) baseResp;
// String extraData =launchMiniProResp.extMsg; //對應(yīng)小程序組件 中的 app-parameter 屬性
// WeiXinPay.getInstance(this).onResp(baseResp.errCode,extraData);
Intent intent = new Intent(this, MainActivity.class);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setAction(Intent.ACTION_MAIN);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
startActivity(intent);
finish();
}
可接收參數(shù),看本身需求,經(jīng)過以上代碼喚起你的主頁便可。blog
總結(jié)
以上是生活随笔為你收集整理的android 微信小程序 唤起app,Android 微信小程序打不开app方案解决的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: React 入门手册
- 下一篇: Android安卓小程序-随机数生成器