--
@jesus.moldex Thank you for your response.
To answer your question regarding the variable isProcessing
, this variable is used to avoid multiple requests for capture and share screenshot while one is running. As capturing a png, writing it to file and attaching it to intent might take few seconds, so during that duration, we block other requests for the same. If you want to see it’s actual work, tap on the share button twice while processing, it will share only once and ignore the second click event.
Also, I saw the code you shared. You are trying to use Native Android code to capture to save the screenshot even which is not required. “getContentResolver
” and “android.graphics.BitmapFactory
” are native Android functionalities which we don’t need in our case. We can capture the screenshot using Unity method
ScreenCapture.CaptureScreenshot (screenshotName, 1);
which will do the same functionality and save the output file at path defined in screenshotName
variable.
Also, the only case when line number 79 won’t be executed will be when you are using a custom activity class which can be checked in Manifest.xml file (if you are using your own). In that case, pass the new class name along with the package name while creating the Activity class object (line 77).
The above code has nothing to do with the Android versions as Intent and Intent sharing is available from API level 1 about which you can read here.
I can assure you this thing, we are not using anything else in the above code which is API dependent and which won’t work because of API level or device.
Please try to remove the native code you are trying to use to capture the screenshot even and use only this C# script separately to share the screenshot.
Please revert if I missed something in your code and if you are trying to achieve some other functionality with your native code.
Hope that helps.
Let me know if there is anything I can help further.