Android Question Launch app that has hidden icon:- not working

gz7tnn

Member
Licensed User
Longtime User
I hope someone may be able to help here.

What I am trying to do is have a main app that runs and calls other apps that I will also be developing
The main app will list any other installed app it finds with a specific naming convention.
The intention then is for the user to click on any of the other apps in the list and have that one launch.
I have that whole concept working - but - and here is the challenge.
I dont want to have the other app show up in the normal list of available ones. ie I want it to remain hidden and only be launched via my main one.

I have also achieved that as well using either of the following manifest code:
#1
AddReplacement(<category android:name="android.intent.category.LAUNCHER" />,<!--<category android:name="android.intent.category.LAUNCHER" /> -->)
'SetActivityAttribute(Main, "android:excludeFromRecents","true")
#2
AddReplacement(android.intent.action.MAIN, unused_action)

But the challenge here is that if I use either of the above manifest entries, the 'hidden' app does not launch. It does work if I comment these out, but that is not what I am wanting.

The code that is run to launch the 2nd app is:
('whatapp' is passed as a parameter to the Sub.)

Try
Dim Intent1 As Intent
Dim pm As PackageManager
Intent1 = pm.GetApplicationIntent(whatapp)
Log("Intent1 should be : "&Intent1)
ToastMessageShow ("Intent 1 is "&Intent1, True)
StartActivity (Intent1)
Catch
ToastMessageShow ("Failed to launch other app !!", True)
End Try

I get the following logs

#1 where the app is hidden:-
Position during click is : 1
WOW hidden - klc.wow.hidden
And 'value' is : [run=klc.wow.hidden, desc=WOW hidden, IsInitialized=true
]
WhatApp is : klc.wow.hidden
Intent1 should be : (Intent) Not initialized

#2 where it is not hidden:-
** Activity (main) Resume **
Position during click is : 1
WOW hidden - klc.wow.hidden
And 'value' is : [run=klc.wow.hidden, desc=WOW hidden, IsInitialized=true
]
WhatApp is : klc.wow.hidden
Intent1 should be : (Intent) Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=klc.wow.hidden cmp=klc.wow.hidden/.main }
** Activity (main) Pause, UserClosed = false **



At the moment it seems that it works as long as I do not hide the icon in the manifest.

Any thoughts?
 

Blue.Sky

Active Member
Licensed User
Longtime User
Hi
i use widget to active my app
 
Upvote 0

gz7tnn

Member
Licensed User
Longtime User
I don't think that it is possible. Starting from Android 4 an app will only be started implicitly after it was previously started explicitly by the user (the user pressed on the app icon).
Thanks Erel
I will dust off my old 2.3 phone and try it.
 
Upvote 0
Top