androidandroid-intenthomescreen

How to avoid home screen loading before opening startup app in Android?


I have an application that I would like to present as the first screen the user sees after boot up on an Android device. Currently the application listens for android.intent.action.BOOT_COMPLETED, and starts up automatically (as explained here). All well and good.

The issue is that, almost always, the home screen is visible for maybe a second before my app starts up. I am aware that I could replace the launcher application with my own, but my goal is to present this initial welcome screen without interfering with the user's choice of custom launcher. (I am aware of the UX concerns of forcing a screen upon the user, right now I am just looking at what is possible.)

So my question is: is there a way to do this? Perhaps to interrupt the very first launch of the home screen, or ensure that my app shows up first? If not, would it possible to create a launcher app that only shows this screen on boot and redirects to the user's chosen launcher or home application afterwards? My hunch is to receive the Intent.CATEGORY_LAUNCHER category, present the screen (if it has not been already) or if not send another intent to open the real launcher...again I am unsure if this is possible.

Help appreciated!

EDIT: For example, this app has the same issue if used: the autostarted app comes up after the home screen.


Solution

  • Finally found a solution for it, and it is pretty simple.

    All you have to do is to add these lines into your AndroidManifest receiver:

     <receiver android:name="com.dannywind.delphi.BootReceiver"
                      android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
               <intent-filter>
                    <action android:name="android.intent.action.BOOT_COMPLETED" />
                     <action android:name="android.intent.action.MAIN"/>
                    <category android:name="android.intent.category.HOME"/>
                    <category android:name="android.intent.category.DEFAULT"/>
              </intent-filter>
            </receiver>
    

    And then next time you open your app, the Android System will ask you whether application you want to make your homescreen.

    Hope it works for you.