Android Question whatsapp SetComponent

Almora

Active Member
Licensed User
Longtime User
hi...
I use FileProvider.
I just want to send it with WhatsApp. I tried setComponent.
I could not. Where am I making mistakes. Thank you.

B4X:
    'copy the file to the shared folder
    File.Copy(File.DirAssets, "b4a.png", Starter.shared, "b4a.png")
    Dim in As Intent
    in.Initialize(in.ACTION_SEND, "")
    in.SetType("text/plain") 'it is not related to the file itself.
   
    in.SetComponent("com.whatsapp")

    in.PutExtra("android.intent.extra.STREAM",  CreateFileProviderUri(Starter.shared, "b4a.png"))
    in.Flags = 1
    StartActivity(in)
 

Almora

Active Member
Licensed User
Longtime User
Usa WhatsApp library from @MarcoRome
https://www.b4x.com/android/forum/threads/whatsapp-library.51571/#content

Or search on forum WhatsApp Send Message



B4X:
    File.Copy(File.DirAssets, nome_file, File.DirRootExternal, "devil_logo.jpg")


In this library, the file is copied to the device. I do not want her to copy it to the device. The file provider sends it to the device without copying it.

How can I get it back when I copy it to the device? Delete it from the device when the user sends the file.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
The dirassest folder is private and can only access the app. You can not link a file to this folder for external use. You could copy it to DirDefaultExternal, but it is usually not recommended. The best solution is what you found., Create a folder on DirRootExternal and after the gates.
 
Upvote 0
Top