这是我的代码:
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.M)
Uri uri = FileProvider.getUriForFile(context, "PacMe", pdfCreate);
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.setDataAndType(uri, "application/pdf");
context.startActivity(intent);
}
public Disposable zipMethode(ContentLoadingProgressBar progressBar,PDFView pdfView,RecyclerView recyclerView) {
progressBar.setVisibility(View.VISIBLE);
return Observable.zip(createPdf(), showPdf(progressBar,pdfView,recyclerView).subscribeOn(AndroidSchedulers.mainThread()).
observeOn(AndroidSchedulers.mainThread()), (o, o2) -> true)
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe();
}
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="pacMe"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
<paths>
<external-path
name="external_files"
path="."/>
该程序可以正常运行,但在 android 28 及更高版本中无法运行。
问题是什么?
我已经参与了很长时间。