I have found examples here: Android - Intent that open widget context menu and here: http://coderender.blogspot.com/.
The first one launches the widget picker, but goes it goes away when you select anything. The second one lets you pick a widget, but it shows it in the application view. Is there a way to call the widget selection from a button in an app but still have the main screen on the phone be the AppWidgetHost?
It may be me misinterpreting things, but it looks to me like the AppWidgetHost has to be the application where you are calling the widget selection menu.
Is there a way to call the widget selection from a button in an app but still have the main screen on the phone be the AppWidgetHost?
Only if you are the home screen.
It may be me misinterpreting things, but it looks to me like the AppWidgetHost has to be the application where you are calling the widget selection menu.
More importantly, it is the AppWidgetHost that must do the work to make use of the selection.
Related
I have developed a Widget for my Android App, and It can be added in following ways.
User can long press in the Home launcher and select Widgets and then drag and drop to Home Launcher Screen, like this -
and then
From the App, in a button click, If
Build.VERSION_CODES.O && appWidgetManager.isRequestPinAppWidgetSupported is true
then we call
appWidgetManager.requestPinAppWidget
And It works, for some devices It doesn't work even if isRequestPinAppWidgetSupported was true.
I am looking for a way to navigate user to 1st way ( going to select widget screen) from my app, whenever isRequestPinAppWidgetSupported was false.
I've used:
addWidgetActivityLauncher.launch(Intent(AppWidgetManager.ACTION_APPWIDGET_PICK).apply { putExtra(EXTRA_APPWIDGET_ID,requireActivity().appW.allocateAppWidgetId()) })
But this opens up a screen like this
,
but clicking on my widget doesn't do anything. Just closes this dialog.
I want to automate the 1st way till the widget selection screen from my app.
PLease help me discover what I am missing.
I must make something like that.
I run my application and press button "Create widget" and the widget is created on Home screen.
I don't know how to do it, Just i know how to take widget to home screen when i choose my widget in widgets menu and write text what i want in this widget
And I know how to run ConfigureActivity on my application but when i writte some text and press add "widget" it don't create. I think i don't have any id's to create widget but how to get that? Random or something.
I used in Android Studio New > Widget > App Widget.
I run my application and press button "Create widget" and the widget is created on Home screen.
This is not possible. The only app that can add an app widget to the home screen is the home screen itself.
I want the user to be able to open another app of his choice from my app. I want the experience to be the same (or similar) to hitting that little button with six dots on the home screen. (What is that screen called to which that the button takes the user?)
Can I send an intent to this menu view? If so, what is it called?
the same (or similar) to hitting that little button with six dots on the home screen
Only some home screens have a button fitting that description. Different home screens might use other icons for this.
What is that screen called to which that the button takes the user?
That is variously referred to as the launcher or the app drawer.
Can I send an intent to this menu view?
Not in general. It is conceivable that some home screen implementations expose something that can trigger opening that, but it would vary by home screen.
You are welcome to make your own launcher, by using PackageManager to find all the activities that support the MAIN/LAUNCHER <intent-filter>. This sample project demonstrates how to do this.
I'm working on a lockscreen widget(not trying to be specific here, but Nexus 7 ) . The widget has a button which would trigger an activity.When the user clicks the button, the unlock slide symbol get's highlighted hinting the user has to slide-unlock his screen before he wants to see the button's activity. Since now, the device is locked,is there a way to bypass this and just display the activity on top of the lock screen? (not in the case of pin/pattern obviously, but only just slide)
Was searching a lot for a way to do it. We need to use flags in while giving an intent to the widget button. More information here.
Android Lock Screen Widget
I have created a widget in my application , now when a widget is clicked I want to show few options in a context menu and allow the user to choose one of them.
My widget contains icon and text , so when a user click over an icon of widget i want to show the context menu.
is there a way to do it ? i am using android 2.3.X and android support compatibility package too.
here is what i want
The widget that i have created is derived from AppWidgetProvider class.
I think there is no way to open a context menu when we click on widget.
But alternatively we can open an activity instead and make it transparent then open a dialog box which contains ListView in that way we can mimic the look of context menu.
That is how i eventually did in my application.