Android Question hide my app icon

Discussion in 'Android Questions' started by Devv, Mar 23, 2015.

  1. Devv

    Devv Active Member Licensed User

    i am trying to hide app icon from launcher

    i tried the following code without any success

    Code:
    Sub Activity_Create(FirstTime As Boolean)
        PMsetComponentEnabledSetting(
    true)
    End Sub


    Sub PMsetComponentEnabledSetting (enable As Boolean)

       
    Dim r As Reflector
      
       
    Dim cn As Object = r.CreateObject2("android.content.ComponentName",  _
          
    Array As Object("cb56.testtwoicons""cb56.testtwoicons.activity2"), Array As String("java.lang.String""java.lang.String"))
      
       r.Target = r.GetContext
       r.Target = r.RunMethod(
    "getPackageManager")
      
       
    'COMPONENT_ENABLED_STATE_ENABLED = 1
       'COMPONENT_ENABLED_STATE_DISABLED = 2
      
       
    Dim e As Int

       
    If enable = True Then
          e = 
    1
       
    Else
          e = 
    2
       
    End If
      
       r.Target = r.RunMethod4(
    "setComponentEnabledSetting"Array As Object(cn, e, 0), _
          
    Array As String("android.content.ComponentName""java.lang.int""java.lang.int"))

    End Sub
     
  2. walterf25

    walterf25 Well-Known Member Licensed User

    If all you want to do is prevent the app icon to appear in the app drawer, then you can use this
    Code:
    AddReplacement(android.intent.action.MAIN, unused_action)
    However the app will still appear in the applications manager list.

    Hope this helps,
    Walter
     
  3. Devv

    Devv Active Member Licensed User

    this is mainfest code ?
     
  4. walterf25

    walterf25 Well-Known Member Licensed User

    Yes, sorry forgot to mention that!
     
    Daniel-White and Devv like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice