Italian Aprire un PDF senza usare B4Xpages

gspanu

Member
Licensed User
Longtime User
Buongiorno a tutti,
la mia richiesta credo sia trita e ritrita ma devo risolvere il problema di aprire un pdf con campi compilabili senza usare B4Xpages,
ho sempre usato Intent per aprirlo :

Dim IntentPDF As Intent
IntentPDF.Initialize(IntentPDF.ACTION_VIEW, "file://" & DevcPath & IdRilievo & "/" & IdPdf )
IntentPDF.SetComponent("com.adobe.reader/.AdobeReader")
StartActivity(IntentPDF)

ma ora con android 14 non funziona più.
Ho visto l'esempio di Erel con B4Xpages, tutto bene... ma non posso riscrivere tutto daccapo! Il resto del codice l'ho aggiornato e funziona correttamente.
Qualcuno può suggerirmi una soluzione senza usare B4Xpages ?
 

Star-Dust

Expert
Licensed User
Longtime User
Non cambia il comando
Assicurati che hai copiato correttamente il manifest e che il file PDF sia in una cartella accessibile ad Adobe Reader
 

DonManfred

Expert
Licensed User
Longtime User
IntentPDF.Initialize(IntentPDF.ACTION_VIEW, "file://" & DevcPath & IdRilievo & "/" & IdPdf )
It will not work with a file uri. You need to use fileprovider with higher targetsdk.

See

24 - must use FileProvider when sharing files (https://www.b4x.com/android/forum/threads/class-fileprovider-share-files.97865/)
 

gspanu

Member
Licensed User
Longtime User
Non cambia il comando
Assicurati che hai copiato correttamente il manifest e che il file PDF sia in una cartella accessibile ad Adobe Reader
Ce l'ho fatta!
In effetti non mettevo i file nella cartella giusta...e un po' di codice preso qua e la. Caso mai potesse essere utile a qualcuno(!?) ti allego lo zip del test.
Grazie mille.
P.S.: ho usato "FileProvider" come suggerito da DonManfred.
 

Attachments

  • TestPDF2.zip
    10 KB · Views: 36
Last edited:

gspanu

Member
Licensed User
Longtime User
It will not work with a file uri. You need to use fileprovider with higher targetsdk.

See

24 - must use FileProvider when sharing files (https://www.b4x.com/android/forum/threads/class-fileprovider-share-files.97865/)

Ho corretto :
Dim i As Intent

i.Initialize(i.ACTION_VIEW, CreateFileProviderUri(Starter.shared, Starter.FileName & "." & Starter.Ext))
i.Flags = 1
i.SetComponent("android/com.android.internal.app.ResolverActivity")
ecc.

Grazie.
 
Top