5

I'm looking for a way to have my app launch an activity when opened directly from the Android market, yet not maintain an activity in the launcher menu. I thought that by using the following settings, I would be able to achieve this:

    <activity android:name="com.package.test.MyActivity" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
        </intent-filter>
    </activity>

However, it appears that with these settings the Activity seemingly doesn't even exist in the app - it cannot be opened from the market and doesn't appear in the launcher menu. However, by simply adding:

<category android:name="android.intent.category.LAUNCHER" />

the app does both. The problem is I do want the activity to run from the Market, but I don't want it in the launcher menu.

Can anyone enlighten me as to how this can be achieved?

5
  • 2
    Few users are going to find your activity later on by visiting the Market listing, because they are not used to opening apps via the Market any time after initial install. This means they would have basically one chance to open your activity -- immediately after the install. Many won't do that, because they do not want to open your app right that moment. Hence, even if this is possible (and from your description, I suspect that it is not), you are just asking for a whole lot of "app's <bleep>ing broken" one-star ratings. I suggest that you reconsider your approach. Mar 5, 2012 at 22:27
  • The idea is that the activity would only ever need to be opened once, and even so it is not mandatory (it's a helper activity for a live wallpaper - it's assumed that the user already knows how to apply a live wallpaper, and if they don't they'll be able to open it from the market without it cluttering their launcher menu).
    – AaronDS
    Mar 5, 2012 at 22:29
  • 1
    First, make sure that the live wallpaper will be usable on Android 3.1+ without the user having launched the activity. Lots of things are disabled now on 3.1+ until they do run an activity. Second, consider leaving the activity alone at the outset and making hiding it from the launcher a preference and using PackageManager and setComponentEnabledSetting(), if that's practical given the nature of your wallpaper. Mar 5, 2012 at 22:38
  • CommonsWare's answer is the default behaviour for many non-launcher apps, like keyboards, wallpapers, etc. Mar 5, 2012 at 22:52
  • Thanks guys but I'll go with the android.intent.category.INFO solution for now.
    – AaronDS
    Mar 5, 2012 at 22:56

1 Answer 1

12

Instead of LAUNCHER, use android.intent.category.INFO. Know that this is not used often, but an example is an add-on package like the Beautiful Widgets animations, where an informational screen beyond the Market listing is useful after the app is installed, but no harm will be done if the user never discovers this activity.

(See also this question.)

3
  • 1
    Excellent, just what I needed. Much appreciated!
    – AaronDS
    Mar 5, 2012 at 22:56
  • @Josh Lee: I'll vote for you if you run on moderator's election :) Excellent answer Mar 4, 2013 at 6:59
  • Thanks a lot, was looking for few days, finally got i :) Feb 23, 2014 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.