I'm using the following code to view PDF files that have saved by the app.
After setting android:targetSdkVersion="31" in the manifest editor, the app crashes when trying to launch the intent on my Android 13 device - Android 12 and below seem to be working fine.
The error message is as follows:
After setting android:targetSdkVersion="31" in the manifest editor, the app crashes when trying to launch the intent on my Android 13 device - Android 12 and below seem to be working fine.
PDF viewer intent:
Sub SendToPDFViewer(pdfFile As String)
File.Copy(Main.sDirSaved, pdfFile, Main.Provider.SharedFolder, pdfFile)
Dim In As Intent
In.Initialize(In.ACTION_VIEW, "")
Main.Provider.SetFileUriAsIntentData(In, pdfFile)
In.SetComponent("android/com.android.internal.app.ResolverActivity")
In.SetType("application/pdf")
StartActivity(In)
End Sub
The error message is as follows:
Error message:
java.lang.NullPointerException: Attempt to invoke interface method 'java.util.List com.android.server.pm.pkg.component.ParsedComponent.getIntents()' on a null object reference
at android.os.Parcel.createExceptionOrNull(Parcel.java:3017)
at android.os.Parcel.createException(Parcel.java:2995)
at android.os.Parcel.readException(Parcel.java:2978)
at android.os.Parcel.readException(Parcel.java:2920)
at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:2043)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1801)
at android.app.Activity.startActivityForResult(Activity.java:5470)
at android.app.Activity.startActivityForResult(Activity.java:5428)
at android.app.Activity.startActivity(Activity.java:5926)
at android.app.Activity.startActivity(Activity.java:5893)
at anywheresoftware.b4a.keywords.Common.StartActivity(Common.java:856)
at com.jsotg.prestart.m1._sendtopdfviewer(m1.java:610)
at com.jsotg.prestart.b4xmainpage._clv_itemclick(b4xmainpage.java:987)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1084)
at anywheresoftware.b4a.keywords.Common.CallSubNew3(Common.java:1047)
at b4a.example3.customlistview$ResumableSub_PanelClickHandler.resume(customlistview.java:805)
at b4a.example3.customlistview._panelclickhandler(customlistview.java:748)
at b4a.example3.customlistview._panel_click(customlistview.java:735)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:7506)
at android.view.View.performClickInternal(View.java:7483)
at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
at android.view.View$PerformClick.run(View.java:29335)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.pm.PackageManagerServiceUtils.applyEnforceIntentFilterMatching(PackageManagerServiceUtils.java:1125)
at com.android.server.pm.ComputerEngine.queryIntentActivitiesInternal(ComputerEngine.java:562)
at com.android.server.pm.ResolveIntentHelper.resolveIntentInternal(ResolveIntentHelper.java:124)
at com.android.server.pm.PackageManagerInternalBase.resolveIntent(PackageManagerInternalBase.java:462)
at com.android.server.wm.ActivityTaskSupervisor.resolveIntent(ActivityTaskSupervisor.java:746)