0
我在我的应用程序中创建图像,并允许用户直接在WhatsApp,Facebook,Instagram等发送它。它不适用于Android 7.1.1。它不会产生任何错误发送它。共享意图工作正常,没有任何问题,只是不工作与facebook,whatsapp等自定义共享意图我的代码如下所示。让我知道,如果有人有任何想法,这是什么错误。分享图片到whatsapp Android 7.1.1
private void shareViaInstaApp() {
try {
Intent instaIntent = new Intent(Intent.ACTION_SEND);
File imageFile = new File(rootFile.toString());
Uri imageUri = FileProvider.getUriForFile(PreviewActivity.this,
BuildConfig.APPLICATION_ID + ".provider", imageFile);
instaIntent.putExtra(Intent.EXTRA_TEXT, "Share..");
instaIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
instaIntent.setType("image/*");
instaIntent.setPackage("com.instagram.android");
instaIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(instaIntent);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
Toast.makeText(PreviewActivity.this, "You don't seem to have Instagram installed on this device", Toast.LENGTH_SHORT).show();
}
}
调试没有从该行提前传递
BuildConfig.APPLICATION_ID + ".provider", imageFile);
感谢
如果你想占有率特定应用程序,你只需要使用