首页 > 编程语言 >nodejs 调用adb拨号

nodejs 调用adb拨号

时间:2022-12-20 11:24:33浏览次数:49  
标签:nodejs 拨号 param let deviceid error adb any

 

 

async function exec (adbCmd:string) {
  let adbPath = 'D:\\prog\\adb\\windows\\adb.exe'
  let cmdMsg = await new Promise((resolve, reject) => {
    const child = execFile(adbPath, adbCmd.split(' '), (error:any, stdout:any, stderr:any) => {
      if (error) {
        reject(error)
      }
      resolve(stdout)
    })
  })
  return cmdMsg
}

async function call(phone:any, deviceid:any) {
  let param:any = ('shell am start -a android.intent.action.CALL -d tel:'+phone)
  if (deviceid) {
    param = '-s ' + deviceid + ' ' + param
  }
  return await exec(param)
}

  

标签:nodejs,拨号,param,let,deviceid,error,adb,any
From: https://www.cnblogs.com/zyip/p/16993784.html

相关文章