Zdravim, nevim jestli to patri primo do te to branze tohoto fora, snad ano ...
Mam tento program napsany v NET - Xamarin
Pokousim se otevrit PDFko integrovanym PDV prohlizecem nasledujicim kodem
private static void ZobrazPDF(string fileName)
{
Java.IO.File file = new Java.IO.File(fileName);
file.SetReadable(true);
Android.Net.Uri uri = FileProvider.GetUriForFile(Android.App.Application.Context, "zs.yoda.yofos.fileProvider", file);
Intent intent = new Intent(Intent.ActionView);
intent.SetDataAndType(uri/*Android.Net.Uri.FromFile(file)*/, "application/pdf");
intent.SetFlags(ActivityFlags.ClearWhenTaskReset | ActivityFlags.NewTask);
try
{
Android.App.Application.Context.StartActivity(intent);
}
catch (FileUriExposedException ex)
{
// Toast.MakeText(Xamarin.Forms.Forms.Context, "No Application Available to View PDF", ToastLength.Short).Show();
}
}
Bohuzel stale se nedari s ruznymi exception na urovni api jedna z poslednich viz obrazek.
<?xml version="1.0" encoding="utf-8" ?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<!--<external-path name="external_files" path="."/>-->
<files-path name="Download" path="Download/" />
</paths>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
package="zs.yoda.yofos"
android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30" />
<application android:label="Galejer" android:theme="@style/MainTheme">
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="zs.yoda.yofos.fileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
Mel by nekdo nejaky napadad?? Uz se stim trapim dost dlouho
Diky za kazdy namet