Best way to get home launcher packagename and start it
<p>I encountered a problem about how to get home launcher packagename.<br>
In android , there are two type of home launcher:</p>

<ol>
<li>orginal launcher </li>
<li>3-third launcher ,such as go-launcher or OEM  </li>
</ol>

<p>So, we can't use specified packagename to start it.<br>
Finally, I figure out a solution. <br>
Is there any other better way to do this?<br></p>

<pre><code>    //find out the package with ACTION_MAIN &amp; CATEGORY_HOME
    Intent i = new Intent();
    i.setAction(Intent.ACTION_MAIN);
    i.addCategory(Intent.CATEGORY_HOME);
    PackageManager pm = this.getPackageManager();
    List&lt;ResolveInfo&gt; ris = (List&lt;ResolveInfo&gt;) pm.queryIntentActivities(i,
            PackageManager.MATCH_DEFAULT_ONLY);
    Log.i("", ris.size() + "");
    //seletc the first one , doc says the first one is the home launcher currently
    if (ris != null &amp;&amp; ris.size() &gt; 0) {
        String pkg = ris.get(0).activityInfo.packageName;
        Log.i("HOME PKG NAME ", pkg);
        //start it 
        i.setClassName(ris.get(0).activityInfo.packageName, ris.get(0).activityInfo.name);
        startActivity(i);
    }
</code></pre>

<p>Thanks for <a href="https://groups.google.com/forum/?fromgroups=#!topic/android-developers/-5aGSOdwJ-8" rel="nofollow">https://groups.google.com/forum/?fromgroups=#!topic/android-developers/-5aGSOdwJ-8</a></p>
