Selective AppWidgets
I have a app which has 2 widgets, lets call them SimpleWidget and ListWidget. ListWidget makes use of android 3.1 (api level 12) features.
What I would like to do is register both widgets if the device is 3.1 or above. If it is not than I would only want to register SimpleWidget.
As the code stands now the widgets are defined in my app's AndroidManifest.xml file. I can't figure out how I could filter this by 开发者_如何学运维sdk level.
The only solution I have found so far would still display both widgets (in android's add widget page) even on pre 3.1 devices (in which case I relegate ListWidget to a SimpleWidget).
Am I missing something?
For example can I register widgets in Java code (maybe in the app's onCreate method) instead of in the manifest file? (seems unlikely since the info is needed before the app is ever run).
精彩评论