iOS Question Sending messages via WhatsApp

toro1950

Member
Licensed User
Hi, as I explained in the last thread, View a pdf, I have developed a couple of apps for Android that I now have to convert to iOS, to finish it I was left with the last step: sending messages via WhatsApp, with the code for Android not works. I thank in advance anyone who wants to help me
Mario
 

toro1950

Member
Licensed User
Hi, Ciao Marco, I certainly didn't explain myself well, anyone who uses the app will download a pdf file from my site and if they want, they can share the file via WhatsApp, and also share a link on another page, the app is b4xpages.
in seguito il codice che uso per android
B4X:
fl = "file.pdf"
    If File.Exists(File.DirInternal, fl) Then
    File.Copy(File.DirInternal, fl,Provider.SharedFolder,fl)
    Dim sendIntent As Intent
    sendIntent.Initialize(sendIntent.ACTION_MAIN,"")
    sendIntent.Action=sendIntent.ACTION_SEND
    sendIntent.SetPackage("com.whatsapp")
    sendIntent.SetComponent("android/com.android.internal.app.ResolverActivity")
    sendIntent.putExtra("jid", EditText2.Text & "@s.whatsapp.net")
    sendIntent.PutExtra("android.intent.extra.STREAM", Provider.GetFileUri(fl))
    sendIntent.PutExtra("android.intent.extra.TEXT","Si allega documento :")
    sendIntent.SetType("application/pdf")
    StartActivity(sendIntent)
        Else
    ToastMessageShow ("File  non trovato, effettuare download",True)
    End If
your code includes the whatsapp number, it is not needed for sending, the user will have to select the name in his wthatsapp list to send it
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
I certainly didn't explain myself well, anyone who uses the app will download a pdf file from my site and if they want, they can share the file via WhatsApp, and also share a link on another page, the app is b4xpages.
in seguito il codice che uso per android
But that is completely different from what you have above and in the title.

Use ActivityViewController
B4X:
Dim avc As ActivityViewController
avc.Initialize("avc", Array("YourText",xui.LoadBitmap(File.DirDocuments,"uPark_Image.png")))
avc.Show(B4XPages.GetNativeParent(Me), Root) 'Second parameter is relevant for iPad only. The arrow will point to the view.
Wait For avc_Complete (Success As Boolean, ActivityType As String)
 
Upvote 0

toro1950

Member
Licensed User
Thanks Alexander, I tried sending pdf files and image files and it works really well, but I also need to send just text, in fact a few words and a link. how to do it?
 
Upvote 0
Top