Error using MakeScreenShot in an Android app

Greetings from the Czech republic,

I use a TTMSWidgetProgress component in my Delphi Android app and need to create a bitmap representation of it.

I considered a method TTMSWidgetProgress.MakeScreenshot suitable for this purpose but after calling it, an error message is shown:

"java.lang.IllegalArgumentException: couldn't find meta-data for provider with authority cz.yamaco.Ems fileprovider " (cz.yamaco.Ems is an identifier of my app)

Would you give me any clue what is wrong please?

Thank you!

Karel

Let me be more specific as for previous question:

Procedure MakeScreenShot is not problematic but following use of created PNG file for ShareSheetAction is:

...
ShowShareSheetAction1.BitMap.LoadFromFile(TPath.GetDocumentsPath + PathDelim + 'Tzm.png');
ShowShareSheetAction1.Execute; //exception

Apology for being not precise and thank you.

Sorry, but how is the share sheet action related to our components, because I assume that any bitmap will throw the same exception?

You're right, nothing in this relationship, I only asked whether you have any experience with a such issue.

Thank you.

Karel

I suppose you can take a look at the demo on how it's implemented.

https://docwiki.embarcadero.com/CodeExamples/Alexandria/en/FMX.ShareSheet_Sample

Helo Pieter, thank you for an useful tip. I'd like to inform you that I found the solution with help of Mr. Salaj from Winsoft Ltd. - maybe it will be purposeful for other programmers:

There are two steps necessary for a proper working on Android API 30 onwards (they were reportedly not necessary on Android API until 29, however in version 30 some security rules were introduced as for shared sheets):

  1. Ad this section into manifest template file:

<provider
android:name="androidx.core.content.Provider"
android:authorities="cz.yamaco.Ems.provider" //in general, applicationID.provider
android:exported="false"
android:grantUriPermissions="true">

  1. Add file file_provider_paths.xml into Deployment with following content:
<?xml version="1.0" encoding="utf-8"?>

and point it into destination location res\xml.

Furthermore, READ_EXTERNAL_DEVICE permission must be implemented by code.

Now works well, thank you.

Karel

1 Like