Hey guys!
I’m trying to implement a feature in my game that the player has the option to share his score through his social media in the game over screen. I would like to programmatically take a screenshot of the screen, attach a custom message and display a share menu like the one in the picture below:
I’ve been playing around with the SDKBOX Social plugin, but I’m not sure it supports this feature. I would like to allow the user to choose whichever application they want to share their score on. Does anyone know if it’s possible to achieve such result with the SDKBOX plugin? Or is there another plugin that supports this feature?
more info <provider android:authorities="com.helloworld.fileprovider" android:exported="false" android:grantUriPermissions="true" android:name="androidx.core.content.FileProvider"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
before share() sdkbox.PluginShare.setFileProviderAuthorities("com.helloworld.fileprovider");
Hi, yinjimmy,
When I implement share plugin, I got this error when sharing a image
error:android.os.FileUriExposedException: file:///data/user/0/com.helloworld/files/myimage.png exposed beyond app through ClipData.Item.getUri()
I saved image with following code jsb.fileUtils.getWritablePath() + "render_to_sprite_image.png"
I checked file_paths.xml, found following lines <external-path name="external_files" path="." /> <external-files-path name="my_images" path="Pictures" /> <external-files-path name="my_movies" path="Movies" />
I added line below <files-path path="./" name="internal_files" />
but it still doesn’t work.
Would you pls help take a look? thank you.
I also tried using external storage, added permission <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
and use following code.
I can see the screenshot has been saved to SD card root dir, but still got same share error.
The android OS is Android 8.1.0, multiDex, useAndroidX is enabled, using androidx.core.content.FileProvider not android.support.v4.content.FileProvider