After you allocate the appWidgetId, you need to launch the
"android.appwidget.action.APPWIDGET_PICK" intent, which will show a
dialog that lets the user pick which widget to bind.  Here's an
example of how Launcher does this:

http://android.git.kernel.org/?p=platform/packages/apps/Launcher.git;a=blob;f=src/com/android/launcher/Launcher.java;hb=cupcake#l1768

You don't need to request any permissions to bind widgets.  In fact,
only the platform can bind them, since binding is the primary security
mechanism for widgets.  If apps could bind widgets programmatically,
one could imagine a "bad" app that would bind to your Calendar widget
without your knowledge and slowly scrape updates about your personal
events over time, etc.

Once the user has successfully finished the binding process, your
onActivityResult() is called, and shortly thereafter you should start
receiving RemoteViews updates from that widget the callbacks you
registered through AppWidgetHost.startListening().

j


On Thu, Aug 6, 2009 at 4:45 AM, karan<[email protected]> wrote:
>
> hi,
>  You need to bind your widgets id first, and for doing that you need
> to do two things
> 1) you will need a permission for binding 2) you will need to share
> your process id.
>
> Let me know if you still face the problem,
>
> On Aug 6, 4:35 pm, mtd <[email protected]> wrote:
>> Hi,
>>   I am trying to create an application that contains AppWidgets, but
>> only get to show the original layout of the same, unable to interact
>> with them. The main steps that I followed are:
>>
>>                 AppWidgetManager mAppWidgetManager = 
>> AppWidgetManager.getInstance
>> (this);
>>
>>                 AppWidgetHost mAppWidgetHost = new AppWidgetHost(this, 
>> hostId);
>>
>>                 appWidgetId = mAppWidgetHost.allocateAppWidgetId();
>>
>> // i is an integer used to specify the widget I want to insert
>>
>> AppWidgetHostView appWidgetHostView = mAppWidgetHost.createView(this,
>>                                 appWidgetId, appWidgetProviderInfo.get(i));
>>
>>                 appWidgetHostView.setAppWidget(appWidgetId,
>>                                 (AppWidgetProviderInfo) 
>> appWidgetProviderInfo.get(i));
>>
>>  And then insert the appWidgetHostView into my application layout.Has
>> anyone managed to enter AppWidgets into their applications and can
>> tell me what I'm doing wrong?
>>
>> Thank you very much
>
> >
>



-- 
Jeff Sharkey
[email protected]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to