I have an application with share image on whatsapp in android. It was working till now.But now I get the following error
"The file format is not supported."
Nothing changed on code.
btnWhatsapp.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if (isAppInstalled("com.whatsapp")) {
// APP INSTALLED
Intent sendIntent = new Intent(Intent.ACTION_SEND);
String sharetext ="Try my app";
sendIntent.putExtra(Intent.EXTRA_TEXT,sharetext );
Uri screenshotUri = Uri.parse("android.resource://"+getPackageName()+"/drawable/"+logofilename);
sendIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
sendIntent.setType("image/png");
sendIntent.setPackage("com.whatsapp");
v.getContext().startActivity(sendIntent);
}else{
Toast.makeText(getApplicationContext(),R.string.nowhatsapp,Toast.LENGTH_SHORT).show();
}
}
});
The file you are trying to share is in the package (your app) only your app can access the file. You need to share a public file
share.putExtra(Intent.EXTRA_STREAM,
Uri.parse( Environment.getExternalStorageDirectory()+ File.separator+"temporary_file.jpg"));
like this other app can have access
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With