wodzu
wodzu

Reputation: 3172

Place app widget on homescreen out of an activity

I know that it's not possible to place an app widget programatically on the homescreen - the user has to do it by himself. But is there a way, to let the user create an app widget without having to go to the "widgets-tab" and choosing it from the list of all available widgets?

My idea is to have a Button in my Activity, which provides some kind of shortcut to that list . This way the user still would create it by himself, but he wouldn't have to leave the app. Is there an Intent I could use in combination with startActivityForResult()?

Upvotes: 0

Views: 256

Answers (2)

Jose Gómez
Jose Gómez

Reputation: 3224

In Android O, its possible to pin app widget programmatically. Just watch at example here

Also check out Google official documentation

Upvotes: 0

D.Bish
D.Bish

Reputation: 208

Have a look at CommonsWare answer here:

Add widget to homescreen from Android application

You can bring the list up put you are unable to select a widget and install it for that your app must be an appWidgetHost

Upvotes: 1

Related Questions