22 lines
668 B
Bash
22 lines
668 B
Bash
#!/bin/bash
|
|
ko=$((
|
|
echo "auth $(cat ~/.emulator_console_auth_token)"
|
|
echo "geo fix $1 $2 0.0"
|
|
sleep 0.2
|
|
) | telnet localhost 5554 2> /dev/null | grep KO: );
|
|
|
|
if [ -z "${ko}" ]; then
|
|
# Check if the location was actually set, for some reason the location moching doesn't work,
|
|
# unless google maps is launched first, and is given access to the phone location
|
|
adb shell dumpsys location | grep 'last location=Location\[gps' > /dev/null
|
|
if [ $? -ne 0 ]; then
|
|
echo Failed to actually set the location, probably need to launch google maps first
|
|
exit 1
|
|
fi
|
|
echo Succesfully set the coordinates to: $(. /conf/get_location.sh)
|
|
exit 0
|
|
else
|
|
echo "$ko"
|
|
exit 1;
|
|
fi
|