I'm trying to track devices, SIMs and airtime cards for test purposes. I have multiple devices plugged into a computer and since the recent update to Android 12, I am not able to get the device IMEI. The IMEI is basically the device's FCC-required serial number and can be obtained from the UI with relative ease, but how can I obtain it via ADB or in some automated method on multiple devices from multiple carriers and OEMs?
Prior to Android 12 FEB patch, I would use service call iphonesubinfo 1 or service call iphonesubinfo 4. But unfortunately after the update I receive back Result: Parcel(ffffffffc ffffffff 00000000 '................') whereas before I would receive a parcel containing the IMEI for processing via script.
Is there a way to get IMEI on Android 12+? I am trying to stay away from using an app. This is a simple thing, from a privileged user (adb shell). It seems like a basic necessity for tracking and logistics purposes.
This command works to obtain IMEI. It works by pressing the dialer key, then typing *#06#, then parsing the text on screen to find the IMEI Label and the next element which contains the actual IMEI. Finally it parses that element by removing all before text=" and all after ".
adb shell "imei=$(input keyevent KEYCODE_CALL;sleep 1;input text '*#06#'; uiautomator dump --compressed /dev/stdout|sed s/\>\<\/\\n/g|grep -A1 IMEI|tail -n1|sed -e 's/.*text=\"//' -e 's/\".*//'); echo ${imei}"
to get just the 16-digit IMEI without checksum, replace the final echo statement with echo ${imei:0:16}
I found a good solution for Samsung One UI
First, run the About menu
adb shell am start -a com.android.settings.ACTION_DEVICE_INFO_SETTINGS
Then dump the UI
adb shell uiautomator dump
View the dump file
adb shell cat /sdcard/window_dump.xml
The IMEI1 in the <node index="12" and IMEI 2 in <node index="13"
Related
In my job, I work a lot with different android devices and interface with them using adb. Rather than remembering or needing to copy their serial numbers or IP addresses to refer to them, I've been trying to use aliases, but I'm running into issues. I'm currently using a combination of functions and profiles to refer to the devices. This is my current Profile.ps1 file:
function googletv_func ($params){
if ($params -eq "connect"){
adb connect 192.168.0.14
}
else{
adb -s 192.168.0.14 $params
}
}
function firehd_func ($params){
adb -s G0W1EW0 $params
}
Set-Alias googletv "googletv_func"
Set-Alias firehd "firehd_func"
If I enter the command "googletv connect", it will successfully connect to the google tv. But if I try something with more than one parameter following the alias (e.g. "googletv install example.apk" or "firehd shell pm list packages") it only executes the single parameter following the alias. Wondering what I'm missing and I appreciate anyone's help.
Did anyone tried Android multiple display feature which is new in Android O
Following steps which is not working for me
1.connect hdmi cable to mobile(not sure can use USB as well)
2.make device in root and give following command (expect app is installed)
and not seen that app is launching on secondary(Multiple display feature
) it's just reflecting mobile display as it is because connected hdmi cable
adb shell am start com.Chrome.Canary --display 1
Please suggest any other way or any command to make it work?
Android in general do mirroring when two displays are connected. Right now google has not enabled support for touch and display mapping on the two displays. But if you want to launch any activity on any of the two displays then the command adb shell am start "your_activity" --display display_id will launch your activity on that particular display id. If the above command doesn't launch your activity then you can use adb shell am stack start display_id "your activity". This will also work. But regarding touch, it will be mapped to the primary display (display id 0). As per google you can enable the mapping of touch in EventHub.cpp of Android source code but till now I haven't found it useful. Hope my answer helps you.
Ran using below procedure passed with dell monitor:
ADB shell can be used to call Activity Manager(am) for starting any system actions (or an activity).
The syntax:
adb shell am start [-n (component)] [-a (action)] [-t (mime type)] [-d (data_URL)]
examples:
1. For starting ‘Settings app’:
adb shell am start -n com.android.settings/.Settings
In the above-mentioned command, we set component(-n) to be settings in a specific format.
For starting ‘Gallery app’:
adb shell am start -t image/* -a android.intent.action.VIEW
In the above-mentioned command, we are setting action(-a) for opening the default app for gallery with mime type(-t) to be image/*
In general, for external display the ‘display_id’ starts from ‘1’ in an increasing order, final command to do multi display operation is
adb shell am start -n com.android.settings/.Settings --display 1
The above command will display ‘Settings’ app only in external display with display_id = 1. The primary display will be in the same mode as before executing the command.
I'm working on a non phone device that run Android 2.3.3. We have a custom Android version (with some additionnal driver) and my application has "system" privileges since we build our apps with the same key used to build android.
I had unlocked full Android API (including com.android.internal.*) following this post : https://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/.
I deleted the Phone.apk from the device to ensure that no process is using rild.
I can instanciate a GSMPhone from my app, but after, I'm unable to execute any commands like supplyPin or getImei. I always have the same error :
CommandException: RADIO_NOT_AVAILABLE.
I'm really stuck here, any help would be precious.
CommandException: RADIO_NOT_AVAILABLE indicates that the rild socket is not opened. In other words, the rild service is not attached to the underlying basebane/modem you are using.
Run ps in adb shell to check if rild service is in the list. If it is in the list, run ls -l /dev/tty* and check if the modem device attached with the Android platform exists here or not. If it does not exist, it means that the Kernel is unable to enumerate your modem device and you need to add support in kernel for it. If it exists, run adb logcat -b radio and check the radio logs output which would really be helpful to diagnose the issue further.
adb shell ps | grep rild to check if RILD is in runing.
Since you can access all the api, do some initialization like PhoneApp do in Phone application OnCreate(mostly like setting params to modem, set radio power which will power on/off the modem, etc)
One way to achieve this is as follows:
adb devices -l
example output:
123abc12 device product:<id> model:<id> device:<id>
456abc45 device product:<id> model:<id> device:<id>
But this list's out all devices connected, but I want to get the information for a specific device.I want information only about "123abc12". The output should be:
123abc12 device product:<id> model:<id> device:<id>
The second device should not be shown.
I have the device name i.e 123abc12, and it can be used to get the required information, but I don't know how.
Thanks.
The correct way to do it would be:
adb -s 123abc12 shell getprop
Which will give you a list of all available properties and their values. Once you know which property you want, you can give the name as an argument to getprop to access its value directly, like this:
adb -s 123abc12 shell getprop ro.product.model
The details in adb devices -l consist of the following three properties: ro.product.name, ro.product.model and ro.product.device.
Note that ADB shell ends lines with \r\n, which depending on your platform might or might not make it more difficult to access the exact value (e.g. instead of Nexus 7 you might get Nexus 7\r).
Why don't you try to grep the return of your command ?
Something like :
adb devices -l | grep 123abc12
It should return only the line you want to.
I would like to get the cell phone number of any android device using the command line.
I have tried using:
adb shell service call iphonesubinfo 4
and
adb shell service call iphonesubinfo 5/6/7/8
and it returns Permission denied.
I was wondering if anyone has another solution?
Ps: phones are android 4.1 and above
Thanks you in advance.
You have to obtain root access by using :
adb root
Then you'll find those command work. Usually the phone number will be returned by :
adb shell service call iphonesubinfo 5
or by :
adb shell service call iphonesubinfo 6
It depends on the device is single or dual sim. You'll need to do some string parsing work if you need this result to be recognized by machine.