3

Is there any way in Android to determine whether a device is running Sense UI? I'm working on an app that is working fine with vanilla Android, but Sense UI is messing with layouts and sizes. I'd like to be able to see whether the device is running Sense UI and so I can take appropriate action.

Josh Brown
  • 52,385
  • 10
  • 54
  • 80

1 Answers1

4

There is nothing built into Android that indicates what sorts of modifications like Sense are running on the device. You would either need to use PackageManager to look for HTC Sense components or use the Build class to determine what model device you are on. In either case, you would need to keep updating that "sniffing" logic as Sense is changed and is rolled out to new devices.

but Sense UI is messing with layouts and sizes

If you have a reproducible test case with source code that demonstrates these problems, I would be interested in seeing it.

There are only two scenarios I can think of that would fit your description:

  1. App widgets may display differently on the HTC Sense home screen, just as they may display differently on other home screens. Ideally, there would be no modification, but since you are running in another app's process, I can't rule it out.

  2. If you rely on android.R resources, those might have been modified by HTC as part of creating Sense, though you can always grab the standard ones from your SDK and ship them with your app.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • It turns out Sense wasn't messing with the layouts and sizes - I was scaling images taken with the camera, and the cameras on different devices were giving me different densities for the images. My mistake. Thanks for the answer! – Josh Brown Jul 09 '10 at 17:02
  • @CommonsWare one of my test phones is a Wildfire S it runs with Gingerbread but the optionsmenu still uses the pre Gingerbread grey background and therefore some of our optionsmenu icons don't look very good. I now try to use the Manufacturer but I don't know how safe it is to assume that all Gingerbread HTC phones run with the sense UI. – Janusz Aug 12 '11 at 14:10
  • 1
    @Janusz: I agree -- it's not safe. OTOH, if you have to guess, and you're trying to keep your guessing logic simple, HTC devices are probably more likely to run Sense than not. – CommonsWare Aug 12 '11 at 14:15
  • Thanks I'm really amazed how fast you are answering. I think that this is enough logic for me to find Sense devices. – Janusz Aug 12 '11 at 14:20