I am trying to craete my first home screen widget. I create it and adjust, and all is ok. But I can't find there is a way to create widget from activity. For example I have a button on my main activity. User hasn't created widget on his screen. Can I create programmatically widget? For example by button click listener?
As per the Pinning App Widgets documentation, on API 26+ devices, allows your app to launch the widget interface to pin a specific widget by using the requestPinAppWidget() API. Apps must use isRequestPinAppWidgetSupported() to check to make sure the launcher supports this functionality.
There's no equivalent on earlier versions of Android.