美文网首页
Android App跳转小程序,返回App(有BUG)

Android App跳转小程序,返回App(有BUG)

作者: 没有了遇见 | 来源:发表于2021-08-12 15:52 被阅读0次

1:跳转小程序

   // 填移动应用(App)的 AppId,非小程序的 AppID  
   String appId = "wxedxxxxxx"; (wx开头)
   IWXAPI api = WXAPIFactory.createWXAPI(this, appId);
   WXLaunchMiniProgram.Req req = new 
   WXLaunchMiniProgram.Req();
  // 填小程序原始id(开头)
   req.userName = "gh_xxxxxx"; 
  //跳转页面的相对路径 不填写默认首页
   req.path = "";
   req.miniprogramType = WXLaunchMiniProgram.Req.MINIPROGRAM_TYPE_PREVIEW;// 可选打开 开发版,体验版和正式版
   api.sendReq(req);

注意相关配置:

    1:WXEntryActivity配置
    <activity
        android:name="com.xxxx.xxx.wxapi.WXEntryActivity"
        android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
        android:exported="true"
        android:taskAffinity="xxx.xxx.xxx"
        android:launchMode="singleInstance">
    
    A:android:exported="true"
    B:taskAffinity  包名
    C: launchMode 启动模式(singleInstance)

BUG情况描述:

1:微信App进程不在后台(手机拉出进程清理页面找不到微信),打开小程序 返回和关闭小程序正常.(正常)

2:微信App进程后台存在(清理进程页面存在微信进程),打开微信小程序,先打开了微信页面,然后再跳转微信小程序,此时无论返回和关系微信小程序全部先回到微信 再返回才能回到App

相关文章

网友评论

      本文标题:Android App跳转小程序,返回App(有BUG)

      本文链接:https://www.haomeiwen.com/subject/pnulbltx.html