简体   繁体   English

配置启动以在连接Android设备时运行Shell脚本

[英]Configure launchd to run shell script when Android device is connected

I want to launch a program on my computer when a particular Android device is connected to my computer running macOS. 当特定的Android设备连接到运行macOS的计算机时,我想在计算机上启动程序。 I know this is possible because when I plug in an Android device. 我知道这是可能的,因为当我插入Android设备时。 I'm using this answer as an example 我以这个答案为例

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.example.program</string>
    <key>ProgramArguments</key>
    <array>
    <string>/path/to/program</string>
    </array>
    <key>LaunchEvents</key>
    <dict>
            <key>com.apple.iokit.matching</key>
            <dict>
                    <key>com.apple.device-attach</key>
                    <dict>
                            <key>idProduct</key>
                            <integer>1234</integer>
                            <key>idVendor</key>
                            <integer>1337</integer>
                            <key>IOProviderClass</key>
                            <string>IOUSBDevice</string>
                            <key>IOMatchLaunchStream</key>
                            <true/>
                    </dict>
            </dict>
    </dict>
</dict>
</plist>

Instead of an Apple device, I want it to launch when an Android device with a particular IMEI number is connected to my computer. 我希望它在具有特定IMEI编号的Android设备连接到我的计算机时启动,而不是Apple设备。

It would be possible with matching android device ids ,vendor id and further adding adb getprop command and read specific result about imei ,other things.i have no knowldege about mac but same can be done in linux with init bg script . 可以通过匹配android设备ID,供应商ID并进一步添加adb getprop命令并读取有关imei的特定结果以及其他方式来实现。我对mac没有任何了解,但是可以在Linux中使用init bg脚本来完成。 You acn further peep into this app source https://github.com/mortenjust/androidtool-mac 您可以进一步窥探此应用程序源https://github.com/mortenjust/androidtool-mac

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Appium:无法在连接的多个Android设备中运行脚本 - Appium : unable to run script in multiple android device connected 连接到PC时如何在Android手机上运行Shell命令? - How to run shell commands on Android phone when connected to a PC? 当我尝试在真实设备上运行我的应用程序时,Android Studio 显示没有连接的设备 - Android Studio Shows No Connected Device When I try to run my app on a real device 使用Python脚本检查android设备是否已连接到互联网 - Python script to check if android device is connected to internet 在Android Studio中在连接的设备上运行测试 - Run test on connected device in Android Studio 即使连接了 android 设备,React Native run-android 也总是启动模拟器 - React Native run-android always launch emulator even when android device connected 使用Android NDK中的系统功能在Android嵌入式设备上运行Shell脚本文件 - Run Shell Script file On Android Embedded Device using System function in Android NDK 如何从adb shell获取连接到Android设备的设备列表 - How to get a list of devices connected to an Android device from adb shell Android蓝牙检测设备何时连接问题 - Android Bluetooth detect when device is connected issue 连接设备时出现Android Studio错误 - Android Studio Errors when device is connected
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM