4

How would I prevent my ICS only widget showing up on older phones while still keeping my app backwards compatible. Currently my task manager runs on froyo and beyond but I have an ICS and up widget that I only want to show to compatible users.

Faisal Abid
  • 8,900
  • 14
  • 59
  • 91
  • If you mean home screen widget please see the answer here: http://stackoverflow.com/questions/7064035/is-it-possible-to-show-widget-only-for-a-certain-android-version/7262498#7262498 – Mark Dec 01 '12 at 11:58

2 Answers2

0

You could do a check on the device to see what version it is, using something such as

Build.VERSION.RELEASE

to query which android version it is. Once determined you could make the widget only available to that version level or higher.

sbrichards
  • 2,169
  • 2
  • 19
  • 32
  • How would you make it available/not available?? – iTurki Jul 29 '12 at 02:01
  • Assuming it is set in a view of some sort (I've never dealt with widgets) you can change the setVisibility() option: http://developer.android.com/reference/android/view/View.html#setVisibility(int) – sbrichards Jul 29 '12 at 02:02
  • Assuming you can set it to INVISIBLE (which I doubt), this will not remove it from the device's widgets list. – iTurki Jul 29 '12 at 02:06
0

There is no way currently on Android to do this. Just make two builds.

Faisal Abid
  • 8,900
  • 14
  • 59
  • 91