40 lines
741 B
Bash
40 lines
741 B
Bash
#!/bin/bash
|
|
|
|
last_stat=1;
|
|
output="";
|
|
function set_coords_checked {
|
|
output=$(bash /conf/set_geo.sh $1 $2)
|
|
last_stat=$?
|
|
if test $last_stat -eq 2; then
|
|
echo $output
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
count=0;
|
|
while true; do
|
|
set_coords_checked $1 $2
|
|
if [ $last_stat -eq 0 -o $count -ge 3 ]; then
|
|
break;
|
|
fi
|
|
|
|
adb shell am start-activity com.google.android.apps.maps &> /dev/null
|
|
|
|
count_inner=0;
|
|
last_stat=1;
|
|
while [ $last_stat -ne 0 -a $count_inner -le 40 ]; do
|
|
set_coords_checked $1 $2;
|
|
count_inner=$(( $count_inner + 1 ));
|
|
done
|
|
|
|
adb shell am stop-app com.google.android.apps.maps
|
|
sleep 1
|
|
count=$(( $count + 1 ));
|
|
done
|
|
if [ $last_stat -eq 0 ]; then
|
|
echo $output
|
|
else
|
|
echo Failed to change the coordinates, try again later
|
|
fi
|
|
exit $last_stat
|