Skip to content

Instantly share code, notes, and snippets.

@boyney123
Last active September 29, 2015 06:56
Show Gist options
  • Save boyney123/ea4326510ed25ca32013 to your computer and use it in GitHub Desktop.
Save boyney123/ea4326510ed25ca32013 to your computer and use it in GitHub Desktop.
Simple bash script to remove, build, install and launch your ionic app on all connected android devices (android simulators or actual devices).
#!/bin/sh
#Your app id which can be found in your config.xml file (widget id)
app=com.ionicframework.myNewApp
pathToAPK=platforms/android/build/outputs/apk/android-debug.apk
echo "Running Ionic Build"
ionic build
echo "Started to loop over the connected android devices"
for SERIAL in $(adb devices | grep -v List | cut -f 1);
do
echo "**** Uninstalling the app from the phone ****"
adb -s $SERIAL shell pm uninstall $app
echo "***** Clearing any local data stored with this app on the phone *****"
adb -s $SERIAL shell pm clear $app
echo "***** Installing the app on the phone *****"
adb -s $SERIAL install -r platforms/android/build/outputs/apk/android-debug.apk
echo "***** Launching the app on the phone *****"
adb -s $SERIAL shell monkey -p $app -c android.intent.category.LAUNCHER 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment