Eu tenho um aplicativo que compartilha imagens do URL. Última atualização do Android, recebi a mensagem do instagram "Não é possível carregar a imagem" quando quero compartilhar uma imagem no feed do instagram.
Mas posso compartilhar histórias de imagens, mensagens diretas e todos os lugares ... Estou tendo esse problema apenas no instagram feed.
public void onShareItemOreo() {
// Get access to bitmap image from view
imageView = (ImageView) findViewById(R.id.thumbnail);
// Get access to the URI for the bitmap
Uri bmpUri = prepareShareIntent(imageView);
if (bmpUri != null) {
//outfile is the path of the image stored in the gallery
// Construct a ShareIntent with link to image
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
shareIntent.setData(bmpUri);
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_TEXT,marketLink);
// Launch sharing dialog for image
startActivity(Intent.createChooser(shareIntent, "Share Image"));
} else {
//
}
}
public Uri prepareShareIntent(ImageView imageView) {
// Fetch Bitmap Uri locally
Drawable drawable = imageView.getDrawable();
Bitmap bmp = null;
if (drawable instanceof BitmapDrawable){
bmp = ((BitmapDrawable) imageView.getDrawable()).getBitmap();
} else {
return null;
}
Uri bmpUri = getBitmapFromDrawable(bmp);// see previous remote images section and notes for API > 23
// Construct share intent as described above based on bitmap
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
shareIntent.setType("image/*");
return bmpUri;
}