1. Are you ready for the Galaxy S20? Here is everything we know so far!

Hide application from Android application list

Discussion in 'Android Development' started by artakus, Nov 1, 2010.

  1. artakus

    artakus Lurker
    Thread Starter

    Hello all,

    Is there any way to hide an application icon from Android applications list ? The application should be downloaded from Market and opened some GUI for configuring my application. I don't want to see any icon of my application in applications list. User should not be able to run it.

    By the way I know some way:
    remove this line from manifest
    <category android:name="android.intent.category.LAUNCHER" />

    But it is not worked for me, because the GUI is not shown.

    Thanks very much !
     



    1. Download the Forums for Android™ app!


      Download

       
  2. pancake_old

    pancake_old Guest

    LauncherPro will allow you to hide icons in the app drawer. It's also a great launcher.
     
  3. Shane Bond

    Shane Bond Lurker

    User should not be able to run it.
     
  4. artakus

    artakus Lurker
    Thread Starter

    Thanks all for replay,
    I found a way to hide application icon from application list
    PackageManager pm = getApplicationContext().getPackageManager();
    pm.setComponentEnabledSetting(getComponentName(), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);

    But in time of application reinstalling occurs error "Activity class does not exist" and it is not possible to reinstall application without uninstalling it. .... what's the problem ?
     
  5. JevyJav

    JevyJav Well-Known Member

    Dude just get launcher pro
     
  6. artakus

    artakus Lurker
    Thread Starter


    Launcher Pro is an application. My application should be downloaded from Android Market and there is no guarantee that all users have Launcher Pro.
    I want programmatically hide application icon from application list. The method with PackageManager works for me ... but there is a problem regarding reinstalling. It is important when you want to update the application from Market.:(
     
  7. saberhack

    saberhack Newbie

    make an app for that
     
  8. khichis

    khichis Lurker

    Hi,
    Do you found any solution?
    Please let me now.....

    Thanks
     
  9. bluenova

    bluenova OK Computer

    You're getting the wrong kind of answers because the thread was in the wrong place ;). I've moved it over to the app development section where you will get better advice.
     
  10. denevell

    denevell Lurker

    I'd also read about the editing of the XML file; removal of the android.intent.category.launcher. I'll have a look later. I'm intrigued as to why you want to do this. Why do you?
     
  11. miXer

    miXer Android Enthusiast

    If you want to be able to configure the application, i think you need to have an icon. How should the user be able to configure the application if you don't have an icon?
     
  12. regenc

    regenc Lurker

    Sup guys, i suggest creating a group on your regular app drawer with all your apps minus the ones you want to hide. I named my new group 'All' and i dought anyone will guess to switch to the group i have my private apps on (being the real "all apps"). Even if they are looking for something. The best part is once you select the group to show your everyday usage, it stays on that group until you change it; even upon restarting the phone!
     
  13. jonbonazza

    jonbonazza Android Expert

    I understand that you managed to find an answer to this, however I just wanted to let you know that there is an easier way. In your application's manifest, if you remove the
    <category android:name="android.intent.category.LAUNCHER" /> element from all of your activity elements, then it will not show up. Inversely, if you add the tag to any activity, that activity (whether it is the main one or not), will be given a place in the applications list.
     
    calcng likes this.
  14. ciucaandrei

    ciucaandrei Lurker

    I have found a way for this to work when you reinstall the app.

    Add a broadcast receiver with intent filter action android.intent.action.PACKAGE_ADDED. In the onReceived method you must activate your disabled component :

    ComponentName componentToEnable = new ComponentName(context, Your_disabled_class.class);
    PackageManager pm = context.getPackageManager();
    pm.setComponentEnabledSetting(componentToEnable, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);

    Complete xml for receiver:

    <receiver android:name="PackageChangeReceiver">
    <intent-filter>
    <action android:name="android.intent.action.PACKAGE_ADDED"/>
    <action android:name="android.intent.action.PACKAGE_REPLACED"/>
    <action android:name="android.intent.action.PACKAGE_REMOVED"/>

    <data android:scheme="package"/>
    </intent-filter>
    </receiver>
     
  15. jonbonazza

    jonbonazza Android Expert

    This is the correct way of doing things.
     
  16. Lawrance

    Lawrance Lurker

    Hey Ciucaandrei,
    Actually i can not understand the ComponentName class constructor argument. If i want to hide specific application like "WhatsApp" then i need the package name and class name.

    for 1st Parameter is "String" package name : "packageInfo.packageName" - it shows me "com.whatsapp"
    and the 2nd parameter "String" is class name : "packageInfo.className" it shows me "null".

    And when i create "BroadCastReceiver" it shows me warning :

    11-15 16:40:55.318: W/System.err(32535): java.lang.SecurityException: Permission Denial: attempt to change component state from pid=32535, uid=10127, package uid=10100
    11-15 16:40:55.318: W/System.err(32535): at android.os.Parcel.readException(Parcel.java:1431)
    11-15 16:40:55.318: W/System.err(32535): at android.os.Parcel.readException(Parcel.java:1385)
    11-15 16:40:55.318: W/System.err(32535): at android.content.pm.IPackageManager$Stub$Proxy.setComponentEnabledSetting(IPackageManager.java:2638)
    11-15 16:40:55.318: W/System.err(32535): at android.app.ApplicationPackageManager.setComponentEnabledSetting(ApplicationPackageManager.java:1262)
    11-15 16:40:55.318: W/System.err(32535): at com.example.lockscreenpattern.PackageChangeReceiver.onReceive(PackageChangeReceiver.java:21)
    11-15 16:40:55.318: W/System.err(32535): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2424)
    11-15 16:40:55.318: W/System.err(32535): at android.app.ActivityThread.access$1500(ActivityThread.java:141)
    11-15 16:40:55.318: W/System.err(32535): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1332)
    11-15 16:40:55.318: W/System.err(32535): at android.os.Handler.dispatchMessage(Handler.java:99)
    11-15 16:40:55.318: W/System.err(32535): at android.os.Looper.loop(Looper.java:137)
    11-15 16:40:55.318: W/System.err(32535): at android.app.ActivityThread.main(ActivityThread.java:5103)
    11-15 16:40:55.318: W/System.err(32535): at java.lang.reflect.Method.invokeNative(Native Method)
    11-15 16:40:55.318: W/System.err(32535): at java.lang.reflect.Method.invoke(Method.java:525)
    11-15 16:40:55.318: W/System.err(32535): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
    11-15 16:40:55.318: W/System.err(32535): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
    11-15 16:40:55.318: W/System.err(32535): at dalvik.system.NativeStart.main(Native Method)

    Can you please tell me what's wrong in my code?

    Thanks in Advance.
     
  17. Lawrance

    Lawrance Lurker

    Hey Ciucaandrei,
    Actually i can not understand the ComponentName class constructor argument. If i want to hide specific application like "WhatsApp" then i need the package name and class name.

    for 1st Parameter is "String" package name : "packageInfo.packageName" - it shows me "com.whatsapp"
    and the 2nd parameter "String" is class name : "packageInfo.className" it shows me "null".

    And when i create "BroadCastReceiver" it shows me warning :

    11-15 16:40:55.318: W/System.err(32535): java.lang.SecurityException: Permission Denial: attempt to change component state from pid=32535, uid=10127, package uid=10100
    11-15 16:40:55.318: W/System.err(32535): at android.os.Parcel.readException(Parcel.java:1431)
    11-15 16:40:55.318: W/System.err(32535): at android.os.Parcel.readException(Parcel.java:1385)
    11-15 16:40:55.318: W/System.err(32535): at android.content.pm.IPackageManager$Stub$Proxy.setComponentEnabledSetting(IPackageManager.java:2638)
    11-15 16:40:55.318: W/System.err(32535): at android.app.ApplicationPackageManager.setComponentEnabledSetting(ApplicationPackageManager.java:1262)
    11-15 16:40:55.318: W/System.err(32535): at com.example.lockscreenpattern.PackageChangeReceiver.onReceive(PackageChangeReceiver.java:21)
    11-15 16:40:55.318: W/System.err(32535): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2424)
    11-15 16:40:55.318: W/System.err(32535): at android.app.ActivityThread.access$1500(ActivityThread.java:141)
    11-15 16:40:55.318: W/System.err(32535): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1332)
    11-15 16:40:55.318: W/System.err(32535): at android.os.Handler.dispatchMessage(Handler.java:99)
    11-15 16:40:55.318: W/System.err(32535): at android.os.Looper.loop(Looper.java:137)
    11-15 16:40:55.318: W/System.err(32535): at android.app.ActivityThread.main(ActivityThread.java:5103)
    11-15 16:40:55.318: W/System.err(32535): at java.lang.reflect.Method.invokeNative(Native Method)
    11-15 16:40:55.318: W/System.err(32535): at java.lang.reflect.Method.invoke(Method.java:525)
    11-15 16:40:55.318: W/System.err(32535): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
    11-15 16:40:55.318: W/System.err(32535): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
    11-15 16:40:55.318: W/System.err(32535): at dalvik.system.NativeStart.main(Native Method)

    Can you please tell me what's wrong in my code?

    Thanks in Advance.
     
Loading...
Similar Threads - Hide application Android
  1. App Update
    Replies:
    0
    Views:
    276
  2. Davidsmith15
    Replies:
    0
    Views:
    549
  3. Anavil Soft
    Replies:
    1
    Views:
    667
  4. marcos1981
    Replies:
    17
    Views:
    839
  5. App Update
    Replies:
    0
    Views:
    254
  6. App Update
    Replies:
    0
    Views:
    393
  7. nasrulazeez
    Replies:
    1
    Views:
    319
  8. jestsomguy
    Replies:
    4
    Views:
    1,301
  9. Rgarner
    Replies:
    18
    Views:
    665
  10. kwhopson
    Replies:
    1
    Views:
    680

Share This Page

Loading...