title: Android manifest make apk a launcher app on tablet but normal app on phone
body: <p>How do you make one apk be a <strong>launcher</strong> app on tablets but just a <strong>normal</strong> app on phones? How do you configure the manifest file for this?</p>
  
  <p>By launcher app I mean it will show up as one of the option when the apk is run on tablets:
  <a href="https://i.stack.imgur.com/F3UaA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F3UaA.png" alt="Select home picker"></a></p>
  
  <p>If the same apk is run on phones, it will not show the "Select a home app" picker.</p>
  
  <p>In simple terms, this is the behaviour the apk needs to have:</p>
  
  <p><strong>Goal:</strong></p>
  
  <ul>
  <li>When I click home on <strong>phones</strong>, I should <strong>not see</strong> the app as one of the
  launcher choices.  </li>
  <li>When I click home on <strong>tablet</strong> then I should <strong>see</strong> the
  app as one of the choices.</li>
  </ul>
  
  <p>My approach is I have a ChooserActivity.java that determines what kind of device is being run. If it is a tablet it will start TabletMainActivity.java, if it is phone it will start PhoneMainActivity.java. (The code for finding out if it is a tablet or a phone is okay.)</p>
  
  <p>ChooserActivity.java</p>
  
  <pre><code>    public class ChooserActivity extends AppCompatActivity {
  
      ImageView tabIndicator;
      private static final String TAG = "Chooser";
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_chooser);
          Log.d(TAG, "onCreate2() Chooser");
          finish();
  
          if (findViewById(R.id.tabIndicator)==null){
              //PHONE
              startActivity(new Intent(this, PhoneMainActivity.class));
  
          }else{
              //TABLET
              startActivity(new Intent(this, TabletMainActivity.class));
          }
      }
  
  }
  </code></pre>
  
  <p>res/layout/activity_chooser.xml</p>
  
  <pre><code>    &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context="com.sample.tabletchecker.Chooser"&gt;
  &lt;TextView
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:text="PHONE"
      /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>res/layout-sw600dp/activity_chooser.xml</p>
  
  <pre><code>    &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context="com.sample.tabletchecker.Chooser"&gt;
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:text="TABLET"
          /&gt;
      &lt;ImageView
          android:layout_width="0dp"
          android:layout_height="0dp"
          android:id="@+id/tabIndicator"
          /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>TabletMainActivity.java has the following launcher manifest settings:</p>
  
  <pre><code>&lt;activity android:name=".TabletMainActivity" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;!-- launcher setting --&gt;
              &lt;category android:name="android.intent.category.HOME" /&gt;
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  </code></pre>
  
  <p>PhoneMainActivity.java is just a normal activity, has nothing on the manifest. This is on purpose because I want this activity to be a normal activity on phones.</p>
  
  <pre><code>&lt;activity android:name=".PhoneActivity"&gt;
  
      &lt;/activity&gt;
  </code></pre>
  
  <p>My ChooserActivity.java is the first activity that gets started when the app gets clicked/opened, it then chooses between the 2. 
  ChooserActivity manifest entry</p>
  
  <pre><code>&lt;activity android:name=".ChooserActivity"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
  &lt;/activity&gt;
  </code></pre>
  
  <p>I tried different variations for the intent-filter for the TabletMainActivity.java but never able to get the correct behaviour. I always see the launcher picker being shown. </p>