Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova running / installing on multiple devices at once

Tags:

cordova

Does anyone know if it is possible to run or install an app to multiple devices at once via the cordova cli ?

Currently I have to run the following commands in order to run on multiple devices

cordova run --target=XXXXXXXXXX

cordova run --target=yyyyyyyyyy

cordova run --target=zzzzzzzzzz

Looking for something like

cordova run --target={zzzzzzzzzz yyyyyyyyyy zzzzzzzzzz}

or

cordova run --target=all

Thanks in advance

like image 916
Keith Avatar asked Feb 04 '14 13:02

Keith


2 Answers

I came up with the same issue and got it working for android (use the same logic for other platforms) by using a shell script :

deviceLst=$(adb devices | awk 'NR > 1 {print $1}' | sed ':a;N;$!ba;s/\n/ /g')

IFS=' ' read -a array <<< "$deviceLst"

cd cordova

for element in "${array[@]}"
do
    cordova run android --target=$element
done

cd ..

Where cd cordova is the folder containing the platforms.

Hope this will help you :)

like image 92
LancelotP Avatar answered Nov 13 '22 18:11

LancelotP


Another way to do this, is combining the two commands:

cordova run android --target=XXXXX && cordova run android --target=YYYY
like image 20
manzapanza Avatar answered Nov 13 '22 19:11

manzapanza