[Share] Nothing happens when sharing image on Android (SOLVED)

Hi,
I am trying to use the share extension to share an image that I took using the screenshot extension. But strangely, nothing happens when I press the share button. Any ideas what may be going wrong?

[data is my player data]

local png, w, h = screenshot.png()
local f = io.open(sys.get_save_file(sys.get_config("project.title", "screenshot"), "screenshot"..(data.DATA.SCREENSHOTS)..".png"), "wb")
data.DATA.SCREENSHOTS = data.DATA.SCREENSHOTS + 1
f:write(png)
f:flush()
f:close()

if share then
      share.file(sys.get_save_file(sys.get_config("project.title", "screenshot"), "screenshot"..(data.DATA.SCREENSHOTS)..".png"), "Racing with some bits on BitRiders. ")
end

What does the device log say?

@AGulev we’re using the manifest merge tool for the share extension now right?

1 Like

Yes, we are using the manifest merging tool.

In your example you write png into file screenshot+N and then increase N variable, that means that in share.file function you have filename screenshot+(N +1) but this file still does not exist.

Could you please try to remove this logic with the counter and check it with statically predefined filename, to be sure that problem in sharing extension.

2 Likes

Hmm. Looks like this was the error. Silly me :crazy_face: Thank you for your help @AGulev and thank you a lot for this great extension @britzl

Yet, should this not throw an error that file could be found or something similar ?

There is no error handling built into the sharing extension. On Android it logs the error but does nothing more. It would be a good addition if share.file() would return a boolean+error message. If you need it then create an issue on GitHub, or even better submit a pull request!

2 Likes