Opening email command not working...

lorebarita

Member
Licensed User
Longtime User
Hi,

I would like to open the email via mia application with the command like:
Dim MyIntent As Intent
MyIntent.Initialize(MyIntent.ACTION_MAIN,"")
MyIntent.SetComponent("com.android.email")
MyIntent.AddCategory("android.intent.category.LAUNCHER")

If MyIntent.IsInitialized Then
StartActivity(MyIntent)
End If

Unfortunately it is opening a window where I then have to select the application I want to open with. See image.
I would like the application to open automatically.
Thanks
Lorenzo
 

Attachments

  • Screen2.png
    Screen2.png
    92 KB · Views: 157

margret

Well-Known Member
Licensed User
Longtime User
You can try this:

B4X:
Sub SendMail(SendTo As String, SendBody As String, SendSub As String, SendAtt As String)
   Dim ei As Email
   SendTo = SendTo.Trim
   ei.To.Add(SendTo)
   ei.Body = SendBody
   ei.Subject = SendSub.Trim
   If SendAtt <> "" Then 
      ei.Attachments.Add(SendAtt)
   End If
   Try
      StartActivity(ei.GetIntent)
   Catch
      Msgbox("Email Client Could Not Be Accessed, Please Make Sure You Have Setup Your Email Client", "NOTICE")
   End Try
End Sub
 
Upvote 0
Top