Activity popup not showing screenshot image to share

I want to share a screenshot of my score using the Activity Popup plugin but it doesn’t seem to be finding the image or maybe even saving at all.

This is the error I get…

“display.save() first parameter was nil. Expected a display object”

What am I doing wrong?

Here is my screenshot code

function takePic( event ) local baseDir = system.DocumentsDirectory display.save(group,{ filename="myScreenshot.jpg", baseDir=system.DocumentsDirectory, captureOffscreenArea=true}) print("PIC SAVED") end

The function is called when the player hits the share button.

Activity popup function

function shareScore( event ) takePic() local itemsToShare = { { type = "image", value = { filename = "myScreenshot.jpg", baseDir = system.DocumentsDirectory } }, { type = "string", value = "Can you beat my score" }, } local options = { items=itemsToShare } native.showPopup( "activity", options ) end

Display.save is used to save a display object or display group.

Your error tells you that the object you are trying to save doesnt exist.

Check the corona documentation.

Ok so it’s starting to work like it should and now takes and saves a screenshot of a display group and attaches it to a sms message, which is great! An issue I’m having now is with WhatsApp. When selecting WhatsApp as my method of sharing the screenshot doesn’t seem to attach to the message. Ant reason why this is happening? Cheers

I don’t know what WhatsApp’s requirements are. It may want an image, it may want a URL to an image, it may want a combination of an image, a URL and some text. You may have to discover the right pattern that they need.

Rob

Display.save is used to save a display object or display group.

Your error tells you that the object you are trying to save doesnt exist.

Check the corona documentation.

Ok so it’s starting to work like it should and now takes and saves a screenshot of a display group and attaches it to a sms message, which is great! An issue I’m having now is with WhatsApp. When selecting WhatsApp as my method of sharing the screenshot doesn’t seem to attach to the message. Ant reason why this is happening? Cheers

I don’t know what WhatsApp’s requirements are. It may want an image, it may want a URL to an image, it may want a combination of an image, a URL and some text. You may have to discover the right pattern that they need.

Rob