From c9af436951b99f98c6672bfaed22dd7ca516476f Mon Sep 17 00:00:00 2001 From: Fei Yuan Date: Fri, 18 Mar 2016 02:49:52 -0400 Subject: [PATCH] Fallback to 'service call' to obtain IMEI Uses the solution from http://stackoverflow.com/a/32293148 Tested and works on Android 6.0.1 on Nexus 4. Fixes #9. --- android-interact.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/android-interact.sh b/android-interact.sh index da30c98..acf4c74 100755 --- a/android-interact.sh +++ b/android-interact.sh @@ -27,6 +27,9 @@ if [[ $1 == "uin" ]]; then echo "Got wechat uin: $uin" elif [[ $1 == "imei" ]]; then imei=$(adb shell dumpsys iphonesubinfo | $GREP 'Device ID' | $GREP -o '[0-9]+') + [[ -n $imei ]] || { + imei=$(adb shell service call iphonesubinfo 1 | awk -F "'" '{print $2}' | sed 's/[^0-9A-F]*//g' | tr -d '\n') + } [[ -n $imei ]] || { >&2 echo "Failed to get imei. You can try other methods, or report a bug." exit 1