[android-developers] Re: how to know if it the emulator or device

2009-11-04 Thread Diego Torres Milano
As Dianne mentioned assuming that because there's no wifi you are
running on the emulator is a bit risky. There could be real phones
with no wifi and emulator emulating wifi.
Stick to any of the other methods.

On Nov 4, 6:19 am, Zhihong GUO gzhh...@gmail.com wrote:
 It can not work. There is no exception throws and the wifiManager returned
 can be used as wifiManager.isEnabled()

 2009/11/4 Dianne Hackborn hack...@android.com

  On Tue, Nov 3, 2009 at 11:10 AM, Roman ( T-Mobile USA) 
  roman.baumgaert...@t-mobile.com wrote:

  Furthermore the API call

   (WifiManager)mContext.getSystemService(mWifiService);

  gives you an exception on the Emulator which is an indication that
  Wifi radio is not supported.

  That's only because it doesn't happen to currently be implemented in the
  emulator.  This could very well change in the future.

  --
  Dianne Hackborn
  Android framework engineer
  hack...@android.com

  Note: please don't send private questions to me, as I don't have time to
  provide private support, and so won't reply to such e-mails.  All such
  questions should be posted on public forums, where I and others can see and
  answer them.

   --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
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


[android-developers] Re: how to know if it the emulator or device

2009-11-04 Thread Roman ( T-Mobile USA)
Yep, I agree that checking the Wifi service availability is not the
best idea 

--
Roman Baumgaertner
Sr. SW Engineer-OSDC
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.

On Nov 4, 7:00 am, Diego Torres Milano dtmil...@gmail.com wrote:
 As Dianne mentioned assuming that because there's no wifi you are
 running on the emulator is a bit risky. There could be real phones
 with no wifi and emulator emulating wifi.
 Stick to any of the other methods.

 On Nov 4, 6:19 am, Zhihong GUO gzhh...@gmail.com wrote:

  It can not work. There is no exception throws and the wifiManager returned
  can be used as wifiManager.isEnabled()

  2009/11/4 Dianne Hackborn hack...@android.com

   On Tue, Nov 3, 2009 at 11:10 AM, Roman ( T-Mobile USA) 
   roman.baumgaert...@t-mobile.com wrote:

   Furthermore the API call

    (WifiManager)mContext.getSystemService(mWifiService);

   gives you an exception on the Emulator which is an indication that
   Wifi radio is not supported.

   That's only because it doesn't happen to currently be implemented in the
   emulator.  This could very well change in the future.

   --
   Dianne Hackborn
   Android framework engineer
   hack...@android.com

   Note: please don't send private questions to me, as I don't have time to
   provide private support, and so won't reply to such e-mails.  All such
   questions should be posted on public forums, where I and others can see 
   and
   answer them.

    --
   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.comandroid-developers%2bunsubscr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en



-- 
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


[android-developers] Re: how to know if it the emulator or device

2009-11-03 Thread Emmanuel


On Nov 3, 2:29 pm, Zhihong GUO gzhh...@gmail.com wrote:
 Hi all,

 How to know if the application is running on emulator or on a real device? I
 want to implement a function to detect wifi connection. If the application
 is running on emulator, just skip the wifi detection, while on real device,
 the wifi connection check should be done. how to do that?

 Thank a lot,

 James

Alternatively, you can check the phone model variable:
PhoneModel = android.os.Build.MODEL;
On my G1 phone, it gives me HTC DREAM
For the emulator, it gives sdk.

I don't know what method is preferred by google, but it feels more
secure to me than using the ANDROID_ID var...

Emmanuel
http://androidblogger.blogspot.com/
http://www.alocaly.com/

-- 
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


[android-developers] Re: how to know if it the emulator or device

2009-11-03 Thread lianwei
if (1.equals(android.os.SystemProperties.get(ro.kernel.qemu))) {
// Run in Emulator
}


On Nov 4, 9:21 am, Emmanuel emmanuel.ast...@gmail.com wrote:
 On Nov 3, 2:29 pm, Zhihong GUO gzhh...@gmail.com wrote:

  Hi all,

  How to know if the application is running on emulator or on a real device? I
  want to implement a function to detect wifi connection. If the application
  is running on emulator, just skip the wifi detection, while on real device,
  the wifi connection check should be done. how to do that?

  Thank a lot,

  James

 Alternatively, you can check the phone model variable:
 PhoneModel = android.os.Build.MODEL;
 On my G1 phone, it gives me HTC DREAM
 For the emulator, it gives sdk.

 I don't know what method is preferred by google, but it feels more
 secure to me than using the ANDROID_ID var...

 Emmanuelhttp://androidblogger.blogspot.com/http://www.alocaly.com/

-- 
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


[android-developers] Re: how to know if it the emulator or device

2009-11-03 Thread Roman ( T-Mobile USA)
Furthermore the API call

 (WifiManager)mContext.getSystemService(mWifiService);

gives you an exception on the Emulator which is an indication that
Wifi radio is not supported.

--
Roman Baumgaertner
Sr. SW Engineer-OSDC
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.

On Nov 3, 5:40 am, sham shamcs shamc...@gmail.com wrote:
 In Linux ,use *adb devices* command to see which one is running.

 On Tue, Nov 3, 2009 at 6:59 PM, Zhihong GUO gzhh...@gmail.com wrote:
  Hi all,

  How to know if the application is running on emulator or on a real device?
  I want to implement a function to detect wifi connection. If the application
  is running on emulator, just skip the wifi detection, while on real device,
  the wifi connection check should be done. how to do that?

  Thank a lot,

  James

  --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en



-- 
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


Re: [android-developers] Re: how to know if it the emulator or device

2009-11-03 Thread Dianne Hackborn
On Tue, Nov 3, 2009 at 11:10 AM, Roman ( T-Mobile USA) 
roman.baumgaert...@t-mobile.com wrote:

 Furthermore the API call

  (WifiManager)mContext.getSystemService(mWifiService);

 gives you an exception on the Emulator which is an indication that
 Wifi radio is not supported.


That's only because it doesn't happen to currently be implemented in the
emulator.  This could very well change in the future.

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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

Re: [android-developers] Re: how to know if it the emulator or device

2009-11-03 Thread Zhihong GUO
Hi lianwei,

what's the means of ro.kernel.qemu?



2009/11/4 lianwei lianwei.w...@gmail.com

 if (1.equals(android.os.SystemProperties.get(ro.kernel.qemu))) {
// Run in Emulator
 }


 On Nov 4, 9:21 am, Emmanuel emmanuel.ast...@gmail.com wrote:
  On Nov 3, 2:29 pm, Zhihong GUO gzhh...@gmail.com wrote:
 
   Hi all,
 
   How to know if the application is running on emulator or on a real
 device? I
   want to implement a function to detect wifi connection. If the
 application
   is running on emulator, just skip the wifi detection, while on real
 device,
   the wifi connection check should be done. how to do that?
 
   Thank a lot,
 
   James
 
  Alternatively, you can check the phone model variable:
  PhoneModel = android.os.Build.MODEL;
  On my G1 phone, it gives me HTC DREAM
  For the emulator, it gives sdk.
 
  I don't know what method is preferred by google, but it feels more
  secure to me than using the ANDROID_ID var...
 
  Emmanuelhttp://androidblogger.blogspot.com/http://www.alocaly.com/

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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

Re: [android-developers] Re: how to know if it the emulator or device

2009-11-03 Thread Zhihong GUO
It can not work. There is no exception throws and the wifiManager returned
can be used as wifiManager.isEnabled()

2009/11/4 Dianne Hackborn hack...@android.com

 On Tue, Nov 3, 2009 at 11:10 AM, Roman ( T-Mobile USA) 
 roman.baumgaert...@t-mobile.com wrote:

 Furthermore the API call

  (WifiManager)mContext.getSystemService(mWifiService);

 gives you an exception on the Emulator which is an indication that
 Wifi radio is not supported.


 That's only because it doesn't happen to currently be implemented in the
 emulator.  This could very well change in the future.

 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.


  --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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