How to get Advertising Id using adb?
Is there an equivalent command for retrieving Advertising Id? There is no equivalent command but it is possible if you use grep . The following command works on rooted devices
Technical answers from my Stack Overflow history, with source links and licenses.
Showing 10 of 10 answers tagged bash
Exported May 9, 2026
Is there an equivalent command for retrieving Advertising Id? There is no equivalent command but it is possible if you use grep . The following command works on rooted devices
Shorter than the other answers: Is it better? I'm not sure. As long as it works and you understand it, I don't see a reason to change it.
You need to add whitespace to the conditions:
You need to get the redirect from bit.ly and then download all files. This is real ugly, but it worked: If you use the direct link, this will work:
Change to The >> appends to a file or creates the file if it doesn't exist. The > overwrites the file if it exists or creates it if it doesn't exist. https://serverfault.com/a/196735
You can use a case statement to get the density. This worked for me: Updated code using -le (less than or equal to): Output on my device:
There are many ways you could handle this. You could process $var1 before the loop or add some condition like the following: