Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 541
Austin Avatar asked Dec 31 '25 18:12

Austin


2 Answers

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.

like image 76
Machado Avatar answered Jan 02 '26 06:01

Machado


Add these two lines to your existing launch activity, usually MainActivity, intent-filter.

  <category android:name="android.intent.category.HOME"/>
  <category android:name="android.intent.category.DEFAULT"/>

should look like the following example...

    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
like image 33
edgar_wideman Avatar answered Jan 02 '26 06:01

edgar_wideman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!