Android Question open inbuld gmail app

adastra

Member
Licensed User
Longtime User
You have to use Intents
B4X:
Dim i As Intent

i.Initialize("", "")
i.SetComponent("com.google.android.gm/.ComposeActivityGmail")

StartActivity(I)

great njdude. but what if i want to open other apps. then how to know the string you passed in i.setcomponent function.
 
Upvote 0

adastra

Member
Licensed User
Longtime User
To do that, you can use the UNFILTERED LOGS in the IDE, the intents show up there, it takes a little practice.

above code is giving me the error:
lastexcection android.content.ActivityNotFoundException: Unable to find explicit activity class {com.google.android.gm/com.google.android.gm.composeactivitygmal}; have you declared this activity in your androidmanifest.xml?
 
Upvote 0

adastra

Member
Licensed User
Longtime User
To do that, you can use the UNFILTERED LOGS in the IDE, the intents show up there, it takes a little practice.

can you explain how can i see the unfiltered logs in the IDE
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
If you open the IDE and check the unfiltered logs all the activity on the device will show up there, you will have to read real closely, you can practice by "finding" the GMail intent I posted.

I suggest you CLEAR the logs before doing any search, like I said, it takes a little practice and getting used to.

To get the unfiltered logs, in the IDE click on LOGS on the tabs at the bottom right, then UNCHECK the FILTER box.
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Dude, the B4A IDE, the logs are in the IDE.

gc7zd23.jpg
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Like I explained above, you have to read ALL THE TEXT in the logs and sift through it until you find what you are looking for, you have to also know how to use intents, so, if you don't have a lot of experience at the moment it will be very difficult to explain.

Another way to do that will be using the Phone library and PackageManager, in that case you will need to know the Package name, for example, this will also open the GMail app:
B4X:
Dim pm As PackageManager
Dim i As Intent
 
i = pm.GetApplicationIntent("com.google.android.gm")
 
StartActivity(i)
 
Upvote 0
Top