16

I've created my own app and I want this one to be my launcher. It's a simple app, but it works.

Is it possible to replace the default launcher with my app so that my app always starts by default after booting?

Jon Adams
  • 24,464
  • 18
  • 82
  • 120
B770
  • 1,272
  • 3
  • 17
  • 34

2 Answers2

28

Setting the correct intent filters in your manifest will allow it be prompt you to use it as a replacement:

<activity android:name="Home"
            ...
            android:launchMode="singleInstance"
            android:stateNotNeeded="true">
    <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.HOME"/>
            <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>

See the Intents and Intent Filters documentation from Google.

Jon Adams
  • 24,464
  • 18
  • 82
  • 120
  • 1
    hello Jon and B770, i have successfully implemented lock screen as home screen replacement app. and i also targeting default home screen after unlocking logic by using setComponentEnabledSetting() . but this is working for me till i unlock once. means if i unlock first time than after not getting custom lock screen.. any help? thanks... – Sanket Kachhela May 28 '13 at 12:49
  • 1
    @SanketKachhela: The question and answer relate to home screen replacements; not lock screen replacements. You should ask a new Question with the code you have now, what you're seeing and need to solve, etc. See http://stackoverflow.com/faq#howtoask on how to ask a good question. – Jon Adams May 28 '13 at 13:27
  • 1
    yes.. i implemented as home screen replacement and in unlock logic i disabled this home screen by using setComponentEnableSetting() and in meanifeast i have created activity alias to disable and enable action programetically. but after disabling i am getting only default home screen. any help plz... thanks – Sanket Kachhela May 28 '13 at 13:36
  • 2
    @SanketKachhela: It still sounds like that's another issue. I suggest asking it as a new Question. – Jon Adams May 29 '13 at 13:28
  • This works flawlessy for me, but I then my home button does nothing oustide the lockscreen. Is this just me? – isaganiesteron Jun 10 '14 at 05:32
  • how can i do it programmatically . i am creating a screen lock app. it needs to disable the home button . so i need to set my app as the home screen temporarily . – Sagar Nayak May 21 '16 at 06:14
  • archive of broken link: https://web.archive.org/web/20120207002203/http://developer.android.com/resources/samples/Home/index.html – StrikeForceZero Sep 21 '16 at 17:36
3

You can take a look at the home tutorial http://developer.android.com/resources/samples/Home/index.html

Frank
  • 61
  • 1