// 检查 MainActivity 是否在任务栈中 if (!isMainActivityRunning()) { // 如果不在,启动 MainActivity Log.d("WXEntryActivity", "WXEntryActivity: !== isMainActivityRunning"); // Start MainActivity with delay to ensure storage is complete ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); executor.schedule(new Runnable() { @Override public void run() { Intent intent = new Intent(WXEntryActivity.this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); } }, 100, TimeUnit.MILLISECONDS); } 要在安卓分享的onReq 中解决
wx-open-launch-app无法唤醒安卓app?1、安卓(小米、华为) 2、情况:安卓app在后台运行,则app可以唤醒,如果杀掉app的进程,安卓app就无法唤醒
01-16我解决了,要在onReq 里面拉起MainActivity // 检查 MainActivity 是否在任务栈中 if (!isMainActivityRunning()) { // 如果不在,启动 MainActivity Log.d("WXEntryActivity", "WXEntryActivity: !== isMainActivityRunning"); // Start MainActivity with delay to ensure storage is complete ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); executor.schedule(new Runnable() { @Override public void run() { Intent intent = new Intent(WXEntryActivity.this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); } }, 100, TimeUnit.MILLISECONDS); }
网页开发“微信开放标签”无法唤醒app测试微信开放标签功能“ wx-open-launch-app” ,检测到应用但无法正常唤起应用详见截图和视频 截图: [图片][图片][图片] 视频:https://test.exexm.com:8060/test-wx-open-tag.mp4 [视频] 代码: <wx-open-launch-app id="launch-btn" appid="xxx" extinfo="your-extinfo" > <script type="text/wxtag-template"> <style>.btn { padding: 12px }</style> <button class="btn">App内查看<button> </script> </wx-open-launch-app> <script> var btn = document.getElementById('launch-btn'); btn.addEventListener('launch', function (e) { alert("launch-success") console.log('success'); }); btn.addEventListener('error', function (e) { alert(JSON.stringify(e.detail)) console.log('fail', e.detail); }); </script>
01-16