I am trying to send a text file through Intent to the VC, which I had previously created and saved to the internal storage. However, he writes that he does not support this type of file? The file has the extension .txt
File file = new File(ActivitySettings.this.getFilesDir(), fileName); // создаём новое намерение Intent intent = new Intent(Intent.ACTION_SEND); // устанавливаем флаг для того, чтобы дать внешнему // приложению пользоваться нашим FileProvider intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); // генерируем URI, я определил полномочие как ID приложения в манифесте, // последний параметр это файл, который я хочу открыть Uri uri = FileProvider.getUriForFile(ActivitySettings.this, BuildConfig.APPLICATION_ID, file); intent.setData(uri); // подтвердите, что устройство может открыть этот файл! PackageManager pm = getPackageManager(); if (intent.resolveActivity(pm) != null) { startActivity(intent); }
urilike this:intent.putExtra(Intent.EXTRA_STREAM, uri);and another mime-type probably needs to be specified, just what it needs ...intent.setType("?/?");- woesss