I’m going to share a screenshot of my game by calling a Java function in my code. I used RenderTexture to save the screenshot. I wonder if I should save the image somewhere in the sdcard and then share the image from that path in my Java function or there is a way to share the image without manipulating the sdcard.
Thanks for your reply. I think the link you provided do this job in the opposite way that I wanted. Anyway maybe the best way is saving the image in the internal storage using RenderTexture and then sharing it via JNI using FileProvider or something like that without the WRITE_EXTERNAL_STORAGE permission.
i do not test that way but i think Save + Send path + Load is slower than just passing data.
android often using NC21 format ( 5+ version will use another - already note in API page but can force to use NC21) and you can pass raw byte[] to cocos2d-x and convert from YUI_NC21 to RGB then load that data to Image. i tested it on my camera plugin and it output smooth like native code.
Note: my way can be use when want to capture data from camera with native performance but if you just want share one image so better save and load.
Thanks. For now I want to share an image containing the current score of the player and some sprites of my game, like most of the games share button and I think save and load would be fine for this purpose(correct me if I’m wrong). Anyway, I would be happy if you provide some code and explain more your method.