Undo "Default Home Sceen" as my default home screen - android

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.

Related

2 icons required for one application

I am creating an application that needs two icons. (Is this possible?)
The main icon that is created by default, will launch the application. In this application, there is a "Enable/Disable" button (toggle button).
When this button is on enable, a 2nd icon (shortcut button to do another task) must be made visible on home screen.
And i want to code a onClickListener() on the new shortcut icon. i.e. When this new shortcut icon is clicked, without launching any activity, that particular action must be performed.
i.e. The app should not open but perform its assigned task.
Example: Activity A has a toggle button: if this button is enabled, a shortcut icon is created on homescreen. When this shortcut icon is clicked, the wallpaper of phone changes without any activity being launched.
How to change wallpaper randomly without opening any activity.
Any views about how this can be achieved?

How to toggle between default home launcher and my application using only buttons?

I am wondering if it is possible to set the home launcher with buttons instead of manually doing it through settings.
Example there is two buttons(Home and MyApp), clicking on home will bring me back to the default home screen and clicking on MyApp will bring me to my application home screen. I am running on Kitkat 4.4.2.
You can't, because the device will always show the chooser dialog, do you want to use bla or blabla once only or always.

How to stop my app from exiting when back/home button button is pressed?

I am making an app exclusive for the tablet it was installed to. I wanted to put a restriction so that when the back button or home button is pressed the user will be prompted to enter a password and if the password is correct application be allowed to exit.
Overriding the back button is pretty easy, just override Activity.onBackPressed() to do whatever you want. Don't call super() or it will close the Activity!
Overriding the home button is more problematic. The only way to do so is to make your app a launcher. Then press home and select your app as the default launcher.
I'm not sure that this could be a good idea. You're "blocking" the user in this way. You can probably override the back button but you will not be able to override the home button (without making the app a launcher).
I did a sort of "kiosk" application and I had the same requirements. I ended up rooting the devices and using this Hide Bar application. The user was not able to go back, and the administrator had a button to enter, with a password, into the "admin panel". In this admin panel you can push a button to go to the launcher. From there you can, with a widget included into the Hide Bar app, restore the back and home buttons.
http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html
May be this can help you for setting the passoward.

How do I unset the default home screen programmatically?

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.

How to start the Google home screen on Android when it's not the default?

I have a home screen replacement app. It is set via the GUI to always be used as the home screen. How can I get that activity to start the original home screen on demand? Is there a published activity name for it? I want my replacement home screen to remain the default.
The name of activity is
com.android.launcher.Launcher

Categories

Resources