Android Question MobilevisionEx and fileprovider URI error

saunwin

Active Member
Licensed User
Hi,
I'm (trying) to use MobileVisionEx with sdk target of 28 and I get a URI error. This is documented in other threads and fileprovider is suggested as a solution.
I have fileprovider/filepicker loaded, modified the manifest, but just keep getting errors.
I'm obviously missing something
Anyone help pls ?
TIA


log :-

at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:6300)
at android.view.View$PerformClick.run(View.java:24941)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)
*** Service (starter) Create ***
Using FileProvider? true
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Start Recognize... Recognizer ready = true
main_btntxtrecognizer_click (java line: 404)
android.os.FileUriExposedException: file:///storage/emulated/0/picture.jpg exposed beyond app through ClipData.Item.getUri()
at android.os.StrictMode.onFileUriExposed(StrictMode.java:1960)
at android.net.Uri.checkFileUriExposed(Uri.java:2356)
at android.content.ClipData.prepareToLeaveProcess(ClipData.java:942)
at android.content.Intent.prepareToLeaveProcess(Intent.java:9850)
at android.content.Intent.prepareToLeaveProcess(Intent.java:9835)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1610)
at android.app.Activity.startActivityForResult(Activity.java:4501)
at android.app.Activity.startActivityForResult(Activity.java:4459)
at anywheresoftware.b4a.BA.startActivityForResult(BA.java:542)
at de.donmanfred.TextRecognizerwrapper.takePicture(TextRecognizerwrapper.java:210)
at b4a.example.main._btntxtrecognizer_click(main.java:404)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:6300)
at android.view.View$PerformClick.run(View.java:24941)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)

Manifest :-
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="28"/>
<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.
AddActivityText(FilePicker,
<intent-filter>
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.OPENABLE" />
<data android:mimeType="image/*" />
</intent-filter>
)
 

DonManfred

Expert
Licensed User
1. Please use quote tags for logs.
2. Where is the sample project which shows the correct use of FileProvider?
3. As the project is from 2017 i can imagine it is not using any high targetsdk. Looking at the old project i see targetsdk 22 in the Manifest.

That said i did look at the Librarysource and found out that there are methods used which are not possible with targetsdk 23+.

The problem is in the githubproject which is not updated since years.

I suggest not to use the lib anymore.
 
Upvote 0

saunwin

Active Member
Licensed User
Hi DonManfred, Thank you for your reply.
Quote tags for logs - Noted thank you.
The minimum target sdk for play store is now 28, so I'll have to think again. :(
Thank you
 
Upvote 0
Top