Problem posting image to Twitter

Hi.

I’ve been using GGTwitter by Graham Ranson to make simple posts to Twitter. I tried uploading a image with the same function (what’s is permitted "twitter:post(“message”, “image_name.png”), but it’s not being uploaded neither does the message. I contacted Graham about the issue and he guesses it’s about the new OAuth 2.0 and the Twitter new API.

Is there someone here who has solved the problem to upload an image to Twitter?

Thanks.

Wiler Jr.

Did you ever figure out the problem? I’m having the same issue with image posting.

If you use the ‘social’ plugin, you’ll be able to post images to Twitter.

Its just that 20+ different sharing options popup up on Android when I do:

[lua]native.showPopup(“social”,{

        service = “twitter”,

        message = “hi there!”,

    })[/lua]

But I guess that is the Android way? I just thought that when I specify “twitter” it should be a bit more selective? I wanted to have a Tweet button + Share others button

Yeah, there’s currently no way to force a service on Android. It’ll bring up all services that are available on the device.
One other issue is that it doesn’t support Facebook on Android even though it’s installed and configured. But that’s a known issue and nothing to do with Corona.

On iOS you can choose between twitter, facebook and sina weibo (chinese market).

The social plugin seems to work well though…

Thanks for the help Ingemar.

I’m not having much fun with that plugin on Android. 

When I select the official Twitter app with Android intent sharing it opens as expected, I see the text in a new tweet but then the message “Cannot filter image” appears and no image.

If I choose TweetCaster which I think is a pretty major client, I see the picture and no text.

If I choose Google Hangout both text and image show up nicely.  

I tried 2 different images jpg and png, same thing.

Are you really not having any issues with this plugin? 

Text and image show up on my Android devices: (Using the official Twitter app)

Galaxy S1 (Android 2.3.6)

Galaxy Player 5.8 (Android 4.0.4)

Google Nexus 7 (Android 4.4.2)

I’m just tweeting a simple message and a screenshot display.captureScreen() saved as a png.

So far I haven’t had any problems, however this app isn’t live yet so I don’t know if I just happen to be lucky with my devices.

Thanks again!

I guess I figured it out. You can not share image from Resource Directory successfully all the time, but it will work 100% of the time from documents directory.

EDIT: BTW that is not a fix for GG Twitter issue the thread started about, but I’m happy with the social plugin.

Hmmm…

Using the latest daily build (2288) on a Samsung Galaxy Tab 2 I only get the text in the tweet and not the image. Regardless of whether I use .jpg or .png or system.CachesDirectory or system.DocumentsDirectory.

I use the official Twitter app.

Any ideas?

local options = { service = "twitter", message = "message", url = {urlLink}, image = { baseDir = system.CachesDirectory, filename = "Completed.jpg", }, --listener = TweetCallback, } display.save(display.getCurrentStage(), "Completed.jpg", system.CachesDirectory) native.showPopup("social", options)

Have you tried to put a small delay on showing the popup? Maybe the file needs some time to become available?

I can give it a go tomorrow if you have no luck.

Alas no luck inserting a delay - even 5 seconds delay.

I don’t know if this is an Android fragmentation thing or what. I’m definitely stuck now. Help! :slight_smile:

Best - MAS1

@MAS1
 
It looks like you’re missing an extra { } for image.
The image parameter should be a table of tables. My code looks like this:

native.showPopup(popupName, { service = serviceName, message = msg, image = {{baseDir=system.TemporaryDirectory, filename="chameleon\_ss.jpg"}}, listener = listener, });

The reason for this is so that you can attach more than 1 image.

@ingemar,

Wow! You were right. Once again the docs have tripped me up :frowning:

According to this: http://coronalabs.com/blog/2013/08/06/introducing-the-social-plugin-ios/

image  — a table containing sub-tables

According to this: http://docs.coronalabs.com/api/library/native/showPopup.html

  • options.image is a table of the form { baseDir=, filename= } to the image you wish to post.

Hours wasted! Still - I’m extremely grateful for your help with it. Now, I wonder how easy/difficult it is to post images to Facebook with Android? I’m already worried…

Thanks again - MAS1

During my testing I had no issues posting images to either Twitter (iOS/Android) or Facebook (iOS).

Facebook isn’t an option on Android when using the ‘social’ plugin. This isn’t anything CoronaLabs can do anything about since it’s a problem on Facebook’s end and the Facebook team are not planning to fix it. (https://developers.facebook.com/bugs/332619626816423)

@ingemar,

Yes indeed - iOS works great for posting to Facebook or Twitter - even without the extra {} when posting one image which is what I do on iOS. Of course, the extra {} are necessary on Android - and again, thanks for pointing that out!

I’ll have a look at the Corona sample for Facebook and/or GGFacebook from Glitch Games and see if that works/suits.

Thanks again!

MAS1

Did you ever figure out the problem? I’m having the same issue with image posting.

If you use the ‘social’ plugin, you’ll be able to post images to Twitter.

Its just that 20+ different sharing options popup up on Android when I do:

[lua]native.showPopup(“social”,{

        service = “twitter”,

        message = “hi there!”,

    })[/lua]

But I guess that is the Android way? I just thought that when I specify “twitter” it should be a bit more selective? I wanted to have a Tweet button + Share others button

Yeah, there’s currently no way to force a service on Android. It’ll bring up all services that are available on the device.
One other issue is that it doesn’t support Facebook on Android even though it’s installed and configured. But that’s a known issue and nothing to do with Corona.

On iOS you can choose between twitter, facebook and sina weibo (chinese market).

The social plugin seems to work well though…

Thanks for the help Ingemar.

I’m not having much fun with that plugin on Android. 

When I select the official Twitter app with Android intent sharing it opens as expected, I see the text in a new tweet but then the message “Cannot filter image” appears and no image.

If I choose TweetCaster which I think is a pretty major client, I see the picture and no text.

If I choose Google Hangout both text and image show up nicely.  

I tried 2 different images jpg and png, same thing.

Are you really not having any issues with this plugin?