Widget - Install automatically through the app

Asked

Viewed 45 times

0

I would like to create a feature in the App to automatically add the Widget of the application.

When the user clicks on a button, it automatically inserts the Widget on the home screen.

It is possible?

1 answer

0


Unable to insert the widget automatically, you can open the widget selection for the user to choose from the click on the button:

Intent pickIntent = new Intent(AppWidgetManager.ACTION_APPWIDGET_PICK);
pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetID);
startActivityForResult(pickIntent, KEY_CODE);

It seems to go against some policies of Android, as this opens several security loopholes without the user’s consent.


More information on the links below:

How to add a widget to the Android home screen from my app?

Binding Appwidgets to Appwidgethost - Android

  • I see no problem in negativizing my question... but why negatively answer without any explanation? =/

  • I didn’t understand either, both in the question and in the answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.