Android Question MMS error sending text file

logicielrl

Member
Licensed User
Longtime User
Hi,
Im always get error File not taking charge , any adea ?

i work fine if i send an image .

B4X:
Sub Button1_Click
Dim f As String
f="test.txt"

Dim TextWriter1 As TextWriter
TextWriter1.Initialize(File.OpenOutput(File.DirDefaultExternal, f,  False))
For i = 1 To 10
   TextWriter1.WriteLine("Line" & i)
Next
TextWriter1.Close
SendMessage("123445555","test",File.DirDefaultExternal,f)
  
  
End Sub

Sub SendMessage(PhoneNumber As String, Message As String, Dir As String, Filename As String)
   Dim iIntent As Intent
  iIntent.Initialize("android.intent.action.SEND", "")
            iIntent.setType("vnd.android-dir/mms-sms")
            iIntent.PutExtra("android.intent.extra.STREAM", CreateUri("file://" & File.Combine(Dir, Filename)))
            iIntent.PutExtra("sms_body", Message)
            iIntent.PutExtra("address", PhoneNumber)
       '     iIntent.SetType("image/png")
            iIntent.SetType("text/plain")
    
            iIntent.SetComponent(".ComposeSmsActivity")
            StartActivity(iIntent)
End Sub
Sub CreateUri(uri As String) As Object
    Dim r As Reflector
    Return r.RunStaticMethod("android.net.Uri", "parse", Array As Object(uri), Array As String("java.lang.String"))        
End Sub
 

eps

Expert
Licensed User
Longtime User
Ah right, sorry.

So you're sending an MMS and attaching a text file.

What's the actual error or log content at the point of error and leading up to it?
 
Upvote 0
Top