I think I have understood permissions and used them for LOCATION and WRITE EXTERNAL, etc.
I am not sure why the code below works with Sdkversion 23 but not 26. Which permission do I need to request in order for the app to send emails?
I am not sure why the code below works with Sdkversion 23 but not 26. Which permission do I need to request in order for the app to send emails?
B4X:
Sub SendEmail (SendTo As String, SendBody As String, SendSub As String, SendAtt As String)
Dim FinalEmailIntent As Intent, sPackageName As String
LogColor("Send Att: "&SendAtt,Colors.Red)
If SendAtt = "" Then ' Use new method - will not work with attachments
File.Copy(path1, GlobFileName, Starter.shared, GlobFileName)
FinalEmailIntent.Initialize("android.intent.action.SENDTO", "mailto:" & SendTo)
FinalEmailIntent.putExtra("android.intent.extra.SUBJECT", SendSub)
FinalEmailIntent.putExtra("android.intent.extra.TEXT", SendBody)
FinalEmailIntent.PutExtra("android.intent.extra.STREAM", CreateFileProviderUri(Starter.shared, GlobFileName))
FinalEmailIntent.Flags = 1
FinalEmailIntent.WrapAsIntentChooser("Send E-mail")
Else ' Make our own list of email apps
sPackageName = GetEmailPackage
If sPackageName = "/cancel/" Then Return
If sPackageName = "" Then
Msgbox ("Unable to send email.", "")
Return
End If
Dim MyEmail As Email
MyEmail.To.Add (SendTo)
MyEmail.Body = SendBody
MyEmail.Subject = SendSub
MyEmail.Attachments.Add(SendAtt)
FinalEmailIntent = MyEmail.GetIntent
FinalEmailIntent.SetType("text/plain")
FinalEmailIntent.SetComponent (sPackageName)
End If
StartActivity (FinalEmailIntent)
End Sub