luke2012 Well-Known Member Licensed User Longtime User Mar 9, 2014 #1 How to send intent directly to Whatsapp ? I'm trying to write the code : Code: Copy Dim i As Intent i.Initialize(i.ACTION_SEND, "file://" & File.DirRootExternal & "/pic.png") i.SetType("image/png") i.SetComponent("com.whatsapp") i.WrapAsIntentChooser("Share pic...") StartActivity(i)
How to send intent directly to Whatsapp ? I'm trying to write the code : Code: Copy Dim i As Intent i.Initialize(i.ACTION_SEND, "file://" & File.DirRootExternal & "/pic.png") i.SetType("image/png") i.SetComponent("com.whatsapp") i.WrapAsIntentChooser("Share pic...") StartActivity(i)
DonManfred Expert Licensed User Longtime User Mar 9, 2014 #2 Maybe this helps. Or maybe this one. Upvote 0
luke2012 Well-Known Member Licensed User Longtime User Mar 9, 2014 #3 DonManfred said: Maybe this helps. Or maybe this one. Click to expand... Thanks. I tried this library and I can share images but I don't want to use the share chooser but send the content directly to whatsapp. Upvote 0
DonManfred said: Maybe this helps. Or maybe this one. Click to expand... Thanks. I tried this library and I can share images but I don't want to use the share chooser but send the content directly to whatsapp.
Erel B4X founder Staff member Licensed User Longtime User Mar 10, 2014 #4 This is the correct code: Code: Copy Dim i As Intent i.Initialize(i.ACTION_SEND, "file://" & File.DirRootExternal & "/1.jpg") i.SetType("image/png") Dim jo As JavaObject = i jo.RunMethod("setPackage", Array As Object("com.whatsapp")) StartActivity(i) However it doesn't seem to work. Upvote 0
This is the correct code: Code: Copy Dim i As Intent i.Initialize(i.ACTION_SEND, "file://" & File.DirRootExternal & "/1.jpg") i.SetType("image/png") Dim jo As JavaObject = i jo.RunMethod("setPackage", Array As Object("com.whatsapp")) StartActivity(i) However it doesn't seem to work.
luke2012 Well-Known Member Licensed User Longtime User Mar 10, 2014 #5 Erel said: This is the correct code: Code: Copy Dim i As Intent i.Initialize(i.ACTION_SEND, "file://" & File.DirRootExternal & "/1.jpg") i.SetType("image/png") Dim jo As JavaObject = i jo.RunMethod("setPackage", Array As Object("com.whatsapp")) StartActivity(i) However it doesn't seem to work. Click to expand... I agree @Erel. I discovered that if you put "com.whatsapp/.Main" as component to interact, the chooser will not display and the intent open whatsapp directly. The problem is that a blank message appear without the image expected. Upvote 0
Erel said: This is the correct code: Code: Copy Dim i As Intent i.Initialize(i.ACTION_SEND, "file://" & File.DirRootExternal & "/1.jpg") i.SetType("image/png") Dim jo As JavaObject = i jo.RunMethod("setPackage", Array As Object("com.whatsapp")) StartActivity(i) However it doesn't seem to work. Click to expand... I agree @Erel. I discovered that if you put "com.whatsapp/.Main" as component to interact, the chooser will not display and the intent open whatsapp directly. The problem is that a blank message appear without the image expected.
P Pachuquin Member Licensed User Longtime User May 27, 2014 #6 I send text directly to whatsapp with this code Code: Copy Dim Intent1 As Intent Intent1.Initialize(Intent1.ACTION_SEND ,"") Intent1.SetType("text/plain") Intent1.SetComponent("com.whatsapp/.ContactPicker") Intent1.PutExtra("android.intent.extra.TEXT", TextToSend ) StartActivity(Intent1) Upvote 0
I send text directly to whatsapp with this code Code: Copy Dim Intent1 As Intent Intent1.Initialize(Intent1.ACTION_SEND ,"") Intent1.SetType("text/plain") Intent1.SetComponent("com.whatsapp/.ContactPicker") Intent1.PutExtra("android.intent.extra.TEXT", TextToSend ) StartActivity(Intent1)