0

I am trying to send image and text to whatsapp directly to specific recipient, but only text is send

    String msg = "Message here";
    Uri bitmapUri= Uri.parse(imageUrl);
    Uri uri = Uri.parse("http://api.whatsapp.com/send?phone="+smsNumber +"&text="+msg);

    try {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(Uri.parse(uri+"?image="+bitmapUri));
        startActivity(intent);

    } catch(Exception e) {
        Toast.makeText(this, "Error/n" + e.toString(), Toast.LENGTH_SHORT).show();
    }
  • [check this link get you given answer inside of this link ](https://stackoverflow.com/questions/23077338/share-image-and-text-through-whatsapp-or-facebook) – Raju Tukadiya Aug 21 '19 at 07:01

2 Answers2

0

please visit this answer How to Send a Text message and Image through Whatsapp from Own Application with help of Intent in Android?

Black mamba
  • 462
  • 4
  • 15
0

You can send image using this code.

Uri uri = Uri.parse("android.resource://com.example.test/drawable/image_1");
                sharingIntent.setType("image/jpg"); 
                sharingIntent.putExtra(Intent.EXTRA_STREAM, uri); 
                startActivity(Intent.createChooser(sharingIntent, "Share image using"));
Huzaifa
  • 121
  • 11