1

I am trying to add AppWidget into my application, but it seems like android developer team provided required classes while restricting usage of them (as always with lack of documentation). Seems like the only way i found (in order to acquire fully functional AppWidget object) is using AppWidgetManager.ACTION_APPWIDGET_PICK activity, which is provided by android. Any idea about how to bypass AppWidgetManager.ACTION_APPWIDGET_PICK?

If any android developer team member read this, please add information about to javadoc, or just throw some exception in usage (maybe using exception not appropriate, because AppWidgets still working with UI, without handling touch/click events)... I spend my whole month on it... Just please, android have serious issues about documentation which makes them weak against IOS.

If anyone curious about source code to acquire half-functional AppWidget, here is my previous question.

Thanks in advance... Android documentation victim :)

Community
  • 1
  • 1
Gökhan Barış Aker
  • 4,445
  • 5
  • 25
  • 35

1 Answers1

1

AppWidgets system in android works in following way:

  1. Your allocate appWidgetId via call to AppWidgetHost.allocateAppWidgetId
  2. You let user choose which particular widget he wants via PICK_APPWIDGET intent and system binds you id to this widget AppWidgetInfo
  3. You using AppWidgetInfo provided by system to create AppWidgetHostView

So to bypass PICK_APPWIDGET intent you need to bind appWidgetId to appWidgetInfo by yourself unfortunatly whit requires BIND_APPWIDGET permission which is only avalible to system. Hope it helps.

Nikolay Ivanov
  • 8,897
  • 3
  • 31
  • 34
  • Nikolay thanks for your quick response...Turns out my comment is too long for a comment :)... And i can't response my question within 8 hour. Here is a google docs link for my response https://docs.google.com/document/d/1cyg7rEOV9nt_RGPZgzEr-XYH9mtUXGkhUD68QYY2UKU/edit?hl=en_US . – Gökhan Barış Aker Oct 12 '11 at 09:34
  • Please read my answer more carefully binding widgets requires android.permission.BIND_APPWIDGET permission, and your application cannot get it since its only avalible to system applications – Nikolay Ivanov Oct 12 '11 at 09:45
  • More precisely, BIND_APPWIDGET permission is available to apps which hosts app widgets, like the home screen. It seems Gökhan is not coding a home screen replacement, but a normal app – Jose_GD Aug 27 '13 at 19:11