How to make a launcher

AndroidLauncher

Android Problem Overview


I have been developing for quite a time and I am now trying to make an app that will replace the original home (e.g. HTC sense).

I need the app to open when the the user hits the home button on their phone.

So basically it is a home replacement.

Does any one know how to go about this?

Android Solutions


Solution 1 - Android

Just develop a normal app and then add a couple of lines to the app's manifest file.

First you need to add the following attribute to your activity:

            android:launchMode="singleTask"

Then add two categories to the intent filter :

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

The result could look something like this:

	<?xml version="1.0" encoding="utf-8"?>
	<manifest xmlns:android="http://schemas.android.com/apk/res/android"
	    package="com.dummy.app"
	    android:versionCode="1"
	    android:versionName="1.0" >
	
	    <uses-sdk
	        android:minSdkVersion="11"
	        android:targetSdkVersion="19" />
	
	    <application
	        android:allowBackup="true"
	        android:icon="@drawable/ic_launcher"
	        android:label="@string/app_name"
	        android:theme="@style/AppTheme" >
	        <activity
	            android:name="com.dummy.app.MainActivity"
	            android:launchMode="singleTask"
	            android:label="@string/app_name" >
	            <intent-filter>
	                <action android:name="android.intent.action.MAIN" />
	                <category android:name="android.intent.category.LAUNCHER" />
	                <category android:name="android.intent.category.DEFAULT" />
	                <category android:name="android.intent.category.HOME" />
	            </intent-filter>
	        </activity>
	    </application>
	
	</manifest>

It's that simple!

Solution 2 - Android

They're examples provided by the Android team, if you've already loaded Samples, you can import Home screen replacement sample by following these steps.

> File > New > Other >Android > Android Sample Project > Android x.x > > Home > Finish

But if you do not have samples loaded, then download it using the below steps

> Windows > Android SDK Manager > chooses "Sample for SDK" for SDK you > need it > Install package > Accept License > Install

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionIntelSoftAppsView Question on Stackoverflow
Solution 1 - AndroidChrisView Answer on Stackoverflow
Solution 2 - AndroiddevqmrView Answer on Stackoverflow