Android Question How do I know the exact name of an app?

Michael Gasperi

Member
Licensed User
Longtime User
Lets say I want to launch some commercial app that came from the Google play store with my app. I've seen the code below shown as the way to do that, but I can't figure out how you know what the "com.google.android.youtube" part should be for a different app. Is the youtube part all that changes from one app to the next?

Dim in As Intent
Dim pm As PackageManager
in = pm.GetApplicationIntent("com.google.android.youtube")
StartActivity(in)
 

Michael Gasperi

Member
Licensed User
Longtime User
I run this code and see a list of packages in the debug window. Is there a one to one match between items on that list and applications on my phone? I don't see anything that obviously looks like the app I'm trying to launch.

Dim pm As PackageManager
Dim packages As List
packages = pm.GetInstalledPackages
For i = 0 To packages.Size - 1
Log(packages.Get(i))
Next
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
You can use this service to get the packagename of the actual running activity...
 
Upvote 0

Michael Gasperi

Member
Licensed User
Longtime User
I figured out the package name using this code that shows the related application label along with the package name.

Dim pm As PackageManager
Dim packages As List
packages = pm.GetInstalledPackages
For i = 0 To packages.Size - 1
Log(pm.GetApplicationLabel(packages.Get(i)) & " = " & packages.Get(i))
Next
 
Upvote 0
Top