1. 程式人生 > 其它 >uni-app 喚醒呼叫第三方app並傳參

uni-app 喚醒呼叫第三方app並傳參

目的:uni-app喚醒第三方應用,並傳入引數(登入賬號和密碼)跳過登入,達到使用者無感登入效果!!

1.離線打包設定

包名:cn.com.ptorigin.cms

執行activity:com.bodystm.activity.LoginActivity

引數:

let sendData = {
            "username": "T2021C1",
            "passwd": "123456",
            "baseUrl": "https://cms.wismed.com.cn/"
          };

核心程式碼

  const isApp = plus.runtime.isApplicationExist({
          pname: 
'cn.com.ptorigin.cms' }); if (isApp) { console.log('App已安裝~'); let sendData = { "username": "T2021C1", "passwd": "123456", "baseUrl": "https://cms.wismed.com.cn/" }; plus.runtime.launchApplication({ pname:
"cn.com.ptorigin.cms", action: "com.bodystm.activity.LoginActivity", extra: sendData }, (e) => { console.log('error', e.message) }, ); } else { console.log('App未安裝~'); }

本文參考:https://blog.csdn.net/qq_42306286/article/details/105784002