tipsi/tipsi-appium-helper

Android Permissions

Opened this issue · 0 comments

Is there any place to pass a list of necessary android permissions?

import adb from 'adbkit'

const client = adb.createClient()
export default async function addAndroidPermissions(deviceId, appId, permissions = []) {
  try {
    await Promise.all(
      permissions.map(permission => client.shell(
        deviceId,
        `pm grant ${appId} android.permission.${permission}`
      ))
    )
  } catch (error) {
    throw new Error(`Can not set android permissions: ${error}`)
  }
}
if (config.platformName === 'android') {
  setTimeout(async () => {
    await addAndroidPermissions(config.deviceName, 'com.example', ['CAMERA'])
  }, 3000)
}