React-native shortcut for shaking Android device on MacOS
This story was born because I was getting frustrated every time I needed to open dev menu on the android device when I am developing react-native app.
If you are using emulated device this is easy just focus on the emulator and tap R twice, but if you are using real device you can either shake the real device(makes you look like a crazy guy in office that shakes his phone every few minutes), shake using android studio(I do not use it since I am programming in react-native) or type this to terminal:
adb shell input keyevent 82
I created an alias called ‘shakedevice’ that would run that command but this started to frustrate me as well so I decided to turn this into mac service and bind a keyboard shortcut on it.
So first thing is to open Automator and create new Service.
Now select Utilities in left Library and double click on Run shell script right next to it.
Paste this command inside:
source ~/.bash_profile
adb shell input keyevent 82
You need to source bash_profile so your script would have access to adb path.
In service receives select no input.
Save this service(you will need to give it a name).
You can test is its working by clicking Run.
This is how it should look like:

Now only thing left to do is to bind a shortcut to this service.
Open Keyboard and go to Shortcuts.
Select services,find your service and bind a shortcut to it.
You are now ready to shake your device just by pressing shortcut.
Take note that if you bind a shortcut that is already used by some program it might not work when that program is running.
I binded my to “command+\”.
