How to launch a hidden app?

Jofa

Member
Hello,
I've tried all the possibilities, but i don't know how I can launch an hidden application.
I've putted
B4X:
 Try
    Dim Intent1 As Intent
    Dim pm As PackageManager
    Intent1.Initialize (Intent1.ACTION_MAIN, "")
    Intent1 = pm.GetApplicationIntent ("com.jofa.fortablets")
    StartActivity (Intent1)
Catch
    ToastMessageShow ("Failed to launch app!  Is it installed?", True)
End Try
But if the application is hidden, the code doesn't work :BangHead:
 

Melghost

Member
Licensed User
Longtime User
Hello!
I want to develop a modular app. It has several hidden apps to be launched from a main app. The customer will download the main app for free, and then will be able to buy any of the modular hidden apps. But I want to avoid multiple icons on the customer's desktop.

I've read about the way to hide apps, and the way to launch apps, and now I can do both things separately. Nevertheless I actually don't understand it completely and I can't launch a hidden app. Sorry.

This is my Manifest in the hidden app:

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
'End of default text.
AddReplacement(android.intent.action.MAIN, unused_action)

And this is the package name: melghost.example.noicon


This is the code in my main app:

B4X:
'Opens module
Sub Button1_Click
    Dim Intent1 As Intent
    Dim Paquete As PackageManager
    Intent1=Paquete.GetApplicationIntent("melghost.example.noicon")
    If Intent1.IsInitialized Then
        Intent1.SetComponent("melghost.example.noicon/.main")
        StartActivity(Intent1)
    End If
End Sub


What am I doing wrong? How can I do it work?

Thank you very much.
 
Upvote 0

Melghost

Member
Licensed User
Longtime User
Now it works fine.

My hidden app manifest:
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>
<intent-filter>
<action android:name="melghost.example.noicon.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
'End of default text.
AddReplacement(android.intent.action.MAIN, unused_action)
SetActivityAttribute(Main, android:exported, "true")

And my main app code:
B4X:
'Opens hidden app
Sub Button1_Click
    Dim Intent1 As Intent
    Intent1.Initialize ("", "")
    Intent1.SetComponent("melghost.example.noicon/.main")
    StartActivity(Intent1)
End Sub


Thank you very much.
 
Upvote 0
Top