That will work on real phones, but I also need to get a unique ID per
emulator. The best thing would be to get the information when you use
"adb devices" in command line. It's almost always "emulator-5556" for
the first emulator, and "emulator-5554" for the second. That's the
kind of thing I need, since the first emulator will always have the
same label (emulator-5556), and the second too, etc. What I'm doing
right now is using the actual port used on the computer (using
NetworkInfo), but it's ALWAYS different when I run it. I need to save
some info depending if it's the first/second/third emulator ran. That
info has to be loaded when I open the emulators at a later time.
That's why I need a unique ID for the first/second/third emulator.

On Jul 22, 10:08 pm, Rud <k5...@arrl.net> wrote:
> The code on my blog 
> athttp://mysticlakesoftware.blogspot.com/2009/07/differentiate-emulator...
> might give you some ideas.
>
> From my limited testing with the emulator and a G1 the call to
> Settings.Secure.getString(this.getContentResolver(),
> Settings.Secure.ANDROID_ID); always returns null on the emulator and a
> value on the device.
>
> Rudhttp://mysticlakesoftware.blogspot.com/
>
> On Jul 22, 3:05 pm, Mathieu Plourde <mat.plou...@gmail.com> wrote:
>
> > Hello devs,
>
> > I need to correctly be able todifferentiatebetween emulator
> > instances. I know it's easily done with real devices. With real
> > devices, you can use getDeviceId or getLine1Number from
> > TelephonyManager. With emulators, all the instances have the same
> > device id, same subscriber id, and same line1 number. Is there a way
> > todifferentiatethem? Using NetworkInfo, I can call the toString
> > method and I get my ip and the port on the computer. The problem with
> > that is that the port is always different. I would like something more
> > stable. Like when you use "adb devices" in command line. Emulator #1
> > is almost always "emulator-5556" and emulator#2 is almost always
> > "emulator-5554". Is there a way to get the same info I get from "adb
> > devices" in my code? If not, is it possible to use a command line
> > parameter to force the emulator to use a certain phone number?
>
> > Thank you.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to