I have an activity which acts like a home screen. My question is how can I programmatically ask the user which home screen wants to be the default? I don't want to set my home screen as the default, but to show to the user the dialog to choose the home screen he wants.
My answer is how can I programmatically ask the user which home screen wants to be the default?
The only way to do that is to trigger the home screen to appear, by starting an ACTION_MAIN/CATEGORY_HOME activity. If there is a choice to be made, between your home screen, the device default home screen, and others, the user will get a chooser and will be able to choose which home screen to display. They will also get the "make this the default for this action" checkbox. However, this also has the effect of taking the user to their chosen home screen, and they do not have to set a default.
My recommendation would be for you to leave this alone. They will see this chooser the next time they press the HOME button, anyway, and they will then expect to go to their chosen home screen.
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.
When users presses and holds any App shortcut Icon in a home screen, "remove" and "edit" options appear at the top of the screen so that users can drop them in those options.
I would like to add an extra option at the top when users presses and holds any Icon on home screen or any widget for that matter.
Is it possible to be done by an Android Application?
No. For one, there isn't a single standard "home screen" implementation. If you wanted to write home screen replacement with more options, you could.
This question has a new answer these days. This can now be accomplished in Android 7.1+ using App Shortcuts.
https://developer.android.com/guide/topics/ui/shortcuts.html
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
In my app I am trying to override the default home screen. For that purpose, I have created an activity of category "HOME". When the app launches, it is prompting the user to select the App(Showing my app and default Launcher) to complete the action. If I select "Launcher" ( Default Home screen), then there is no way to choose my app as default home screen.
Can somebody tell me if there a way to undo the "Default Home Screen" as my default launcher for Home activity?
Thanks,
Praveen
clearPackagePreferredActivities() on PackageManager should allow you to do this programmatically, for your own app.
I have a home screen with a Home button. This screen is the default screen when my application starts up. I would like to show the Home button as selected to indicate that the user is in the Home screen when my app starts. How do I do that? Please help.
Thanks.
I think for what you want to do you want to either use a group of RadioButtons, or tabs. If you just want a button that looks different in different states, try using a StateSelector.