Dipesh Dhanji February 2016

Screenshot image is not showing for Twitter share on Android device

I am having this issue which I hope you can help me solve. Basically I have set up twitter sharing on Corona SDK (using the social plugin) so that players can post their highscores. The game would save a JPEG image and then Twitter loads this inside the message when sharing.

Now the issue is that on iOS, this works perfectly, but on Android devices the image doesn't show in the message body. Can you please help me as I have been banging my head trying to figure this out but have gotten nowhere. Cheers.

Here is my code to take the screenshot:

function takePhoto()
    local baseDir = system.DocumentsDirectory

    display.save(overlayGroup, "myScreenshot.jpg", baseDir )
    print("PIC SAVED")
end

And this these are the options for sharing:

local options = {
    service = "twitter",
    message = "You got a highscore! ",
    listener = tweetCallback,
    image = {
      baseDir = system.DocumentsDirectory,
      filename = "myScreenshot.jpg"
    }
}

And these are the code in build.settings

android =
{
    versionCode = "1",
    googlePlayGamesAppId = "xxxxxxxxxx", --My code is here
    usesPermissions =
    {
        "android.permission.INTERNET",
        "android.permission.WRITE_EXTERNAL_STORAGE",
        "android.permission.ACCESS_WIFI_STATE",
        "android.permission.ACCESS_NETWORK_STATE",
    },
}

Answers


Amir February 2016

system.DocumentsDirectory is internal storage. can you add the following.

"android.permission.WRITE_INTERNAL_STORAGE",

Post Status

Asked in February 2016
Viewed 1,912 times
Voted 8
Answered 1 times

Search




Leave an answer