TomGrill / gdx-twitter

libGDX extension providing cross-platform support for Twitter API.
Apache License 2.0
12 stars 2 forks source link

apiError with HttpStatus=-1 when uploading an image #3

Closed Zarandor closed 7 years ago

Zarandor commented 7 years ago

Hi TomGrill, first thank you for gdx-facebook and gdx-twitter I hope to be able to contribute to those extensions when I released my game that I want to port to Html5. For now I concentrate on Android.

So while trying to upload an image of 211 Kb from a directory on my website to twitter using these:

_request = new TwitterRequest(TwitterRequestType.POST, "https://upload.twitter.com/1.1/media/upload.json"); request.put("mediadata", encodedString);

I get an apiError(-1, "")

The issue is the same that the one you mentioned in: http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=19753&p=82658&hilit=HttpResponse+1#p82658

After downloading your lib and add a setTimeOut(3000) to httpRequest in TwitterAPI.java everything works fine.

So can you add a constant in TwitterConfig to set a timeout value and use it in TwitterAPI to send the http request ?

It will also be good to signal that issue and this workaround.

Thanks for your work.

The image I was trying to upload mission_02

Zarandor commented 7 years ago

On Desktop, a value of 3000 ms is enough to make it work but it's not the case on Android where a value of 6000 ms worked.

TomGrill commented 7 years ago

Thing is that we cannot decide how many ms are required. Best approach for the user would be to run the task in the background and report when done. With the new global variable this is possible now.