Android Question Regarding the pdfjet library

maddy

Member
Licensed User

Attachments

  • error.PNG
    error.PNG
    65.4 KB · Views: 296

maddy

Member
Licensed User
Logger connected to: Xiaomi POCO F1
--------- beginning of crash
--------- beginning of system
--------- beginning of main
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
PDFjetPDF1_CloseComplete Success=true
Error occurred on line: 65 (Main)
android.os.FileUriExposedException: file:///storage/emulated/0/pdfjet-test.pdf exposed beyond app through Intent.getData()
at android.os.StrictMode.onFileUriExposed(StrictMode.java:1978)
at android.net.Uri.checkFileUriExposed(Uri.java:2371)
at android.content.Intent.prepareToLeaveProcess(Intent.java:10276)
at android.content.Intent.prepareToLeaveProcess(Intent.java:10248)
at android.content.Intent.prepareToLeaveProcess(Intent.java:10227)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1669)
at android.app.Activity.startActivityForResult(Activity.java:4639)
at android.app.Activity.startActivityForResult(Activity.java:4597)
at android.app.Activity.startActivity(Activity.java:4958)
at android.app.Activity.startActivity(Activity.java:4926)
at anywheresoftware.b4a.keywords.Common.StartActivity(Common.java:848)
at uk.co.martinpearman.b4a.pdfjetexample.main._pdfjetpdf1_closecomplete(main.java:487)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:733)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:352)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA$2.run(BA.java:365)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)




My Manifest -

AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.


Here is the error which i am getting and sent manifest also
 
Upvote 0

maddy

Member
Licensed User
After I added file provider in my project also It is throwing same error.


Sub PDFjetPDF1_CloseComplete(Success As Boolean)
Log("PDFjetPDF1_CloseComplete Success="&Success)
If Success Then
Dim Intent1 As Intent
Intent1.Initialize(Intent1.ACTION_VIEW, "file://"&File.Combine(File.DirRootExternal, "pdfjet-test.pdf"))
Intent1.SetType("application/pdf")
Intent1.WrapAsIntentChooser("Open PDF document using:")
StartActivity(Intent1)
End If
End Sub



This is the code where it is giving error Can you please help regarding this?
 
Upvote 0

maddy

Member
Licensed User
After I added file provider in my project also It is throwing same error.
B4X:
Sub PDFjetPDF1_CloseComplete(Success As Boolean)
Log("PDFjetPDF1_CloseComplete Success="&Success)
If Success Then
Dim Intent1 As Intent
Intent1.Initialize(Intent1.ACTION_VIEW, "file://"&File.Combine(File.DirRootExternal, "pdfjet-test.pdf"))
Intent1.SetType("application/pdf")
Intent1.WrapAsIntentChooser("Open PDF document using:")
StartActivity(Intent1)
End If
End Sub



This is the code where it is giving error Can you please help regarding this?
 
Upvote 0
Top