In an android app, I am using intent to share an image via whatapp ( with Biometic lock enabled)
Whatspp is not able to hold that image ( nor send that image). it just open the specifc chat but with no attachment to send.
It was working before ( 1-2 Weeks back ). I know something is changed from Whataspp side.
private void openWhatsAppAndTelegram(String packageName, SecureRentTaking_GetterSetter activity, String caption) {
File appFolderLocation = new File(cachePath, OUTPUT_RENT_RECEIPT_PNG_NAME);
Uri contentUri = FileProvider.getUriForFile(activity.mContext, BuildConfig.APPLICATION_ID.concat(".provider"), appFolderLocation);
if (contentUri == null) {
In_Place.toastHelper.toastErrorMsg("File Not Present");
} else {
String toNumber = getFormattedNumber(activity.getTenantContactNumber());//getFormattedWatsAppNumber(activity.getTenantContactNumber());
toNumber = toNumber.replace("+", "").replace(" ", ""); // E164 format without '+' sign
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, caption);
sendIntent.putExtra(Intent.EXTRA_STREAM, contentUri);
sendIntent.setDataAndType(contentUri, activity.mContext.getContentResolver().getType(contentUri));
sendIntent.putExtra("jid", toNumber + "@s.whatsapp.net"); //phone number without "+" prefix
sendIntent.setPackage(packageName); //com.whatsapp //com.whatsapp.w4b
sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
if (sendIntent.resolveActivity(activity.mContext.getPackageManager()) != null) {
activity.mContext.startActivity(Intent.createChooser(sendIntent, "Choose an app"));
} else {
In_Place.toastHelper.toastErrorMsg("App is not Installed");
// WhatsApp is not installed, handle accordingly
// You can prompt the user to install WhatsApp or use a different method to send messages
}
}
}
I have found one issue which is similar ( but without any fix/workaround)
Ref : Sharing Content to WhatsApp Fails When AppLock is Enabled
2
I noticed the same too. Super annoying.
1