解决部分Termux:api命令运行无反应以及MacroDroid或Tasker不能调用Termux:tasker

文章讲述了在Termux中遇到部分API命令无响应及Tasker/MacroDroid调用失败的问题,解决方法是通过adb授予com.termux相关的权限,包括但不限于RUN_COMMAND和WRITE_SECURE_SETTINGS。
摘要由CSDN通过智能技术生成

解决部分Termux:api命令运行无反应以及MacroDroid或Tasker不能调用Termux:tasker

1. 问题

  1. 通过Tasker使用Termux:tasker的时候提示错误:接收器丢失、被禁用、未导出、过多或无权限
  2. 在Termux中运行部分Termux:api的脚本无反应,例如使用termux-wifi-enable true的时候不能成功打开wifi。

2. 解决

2.1 使用termux:tasker报错

  • 需要使用adb给权限调用Termux的权限
adb shell pm grant <要调用的应用的包名> com.termux.permission.RUN_COMMAND

例如tasker就使用

 adb shell pm grant net.dinglisch.android.taskerm com.termux.permission.RUN_COMMAND

macrodroid就使用

adb shell pm grant com.arlosoft.macrodroid com.termux.permission.RUN_COMMAND

注意,使用的时候可能需要在开发者选项中打开“禁止权限监控”的选项

  • 其次是检查有无设置了后台运行、自启动、忽略电池优化等等应用权限
  • 还有就是脚本要放在目录~/.termux/tasker/

2.2 运行termux:api的部分脚本无效

解决方法:同样是使用adb授予权限

adb shell pm grant com.termux android.permission.WRITE_SECURE_SETTINGS

应该是这个权限,当时我是全都给了,不确定是不是这个起的作用。

  • 这是使用adb shell dumpsys package com.termux 获取的权限中能通过adb授予的部分。可以全都使用adb授予一下
adb shell pm grant com.termux android.permission.WRITE_EXTERNAL_STORAGE
adb shell pm grant com.termux android.permission.SYSTEM_ALERT_WINDOW
adb shell pm grant com.termux android.permission.READ_LOGS
adb shell pm grant com.termux android.permission.DUMP
adb shell pm grant com.termux android.permission.WRITE_SECURE_SETTINGS
adb shell pm grant com.termux android.permission.PACKAGE_USAGE_STATS
adb shell pm grant com.termux android.permission.POST_NOTIFICATIONS
adb shell pm grant com.termux android.permission.READ_EXTERNAL_STORAGE
adb shell pm grant com.termux android.permission.ACCESS_MEDIA_LOCATION
adb shell pm grant com.termux android.permission.READ_MEDIA_AUDIO
adb shell pm grant com.termux android.permission.READ_MEDIA_VIDEO
adb shell pm grant com.termux android.permission.READ_MEDIA_IMAGES
adb shell pm grant com.termux android.permission.READ_MEDIA_VISUAL_USER_SELECTED
adb shell pm grant com.termux android.permission.READ_SMS
adb shell pm grant com.termux android.permission.READ_CALL_LOG
adb shell pm grant com.termux android.permission.ACCESS_FINE_LOCATION
adb shell pm grant com.termux android.permission.BODY_SENSORS
adb shell pm grant com.termux android.permission.ACCESS_COARSE_LOCATION
adb shell pm grant com.termux android.permission.READ_PHONE_STATE
adb shell pm grant com.termux android.permission.SEND_SMS
adb shell pm grant com.termux android.permission.CALL_PHONE
adb shell pm grant com.termux android.permission.BODY_SENSORS_BACKGROUND
adb shell pm grant com.termux android.permission.CAMERA
adb shell pm grant com.termux android.permission.RECORD_AUDIO
adb shell pm grant com.termux android.permission.READ_CONTACTS
adb shell pm grant com.termux android.permission.ACCESS_BACKGROUND_LOCATION

  • 10
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值