[英]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.