I want to select a video from the gallery and send it to a specific number through WhatsApp. I am able to select the video and open WhatsApp but it shows me to select the contact in WhatsApp. How can I send it directly without selecting a contact in WhatsApp? My currect code is:
/*-------------------------------------------------------------------------------------*/
private void selectVideo(){
Intent intent = new Intent();
intent.setType("video/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select Video"), REQUEST_TAKE_GALLERY_VIDEO);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_TAKE_GALLERY_VIDEO) {
Uri uri = data.getData();
Intent share = new Intent(Intent.ACTION_SEND, uri);
share.setPackage("com.whatsapp.w4b");
share.setType("video/*");
share.putExtra(Intent.EXTRA_STREAM, uri);
share.putExtra(Intent.EXTRA_TEXT, "Hello");
startActivity(Intent.createChooser(share,"Select Video"));
}
}
}
/*-------------------------------------------------------------------------------------*/
I want to send to a specif number like 8721XXXXXX
Hi I know It's very late, but I hope this helps you