Facebook for android video upload - works with one

2019-08-26 22:35发布

问题:

I have a weird problem when uploading a video to facebook...

My code is based on this answer: Is uploading videos from an SD Card to Facebook possible with the Facebook SDK?

It works perfectly with one facebook app, but not with another.

I have 2 facebook apps that I own as an administrator. Both of them are set up with my debug key hash, and both of them have exactly the same settings.

The ONLY thing I change in my code is the app ID (first app or second app).

The behavior for both apps is:

  1. Authorization is successful
  2. The code that uploads video runs successfully, and onComplete() is called after uploading the video.
  3. For the first app (that works), the video appears on my facebook profile. For the second one, it doesn't.

Again, the only change I do is change the app ID in order to test with each of the 2 facebook apps.

Any insights?

UPDATE

Answered my own question below.

回答1:

Solved.

The facebook app that works was created a few months ago. The facebook app that doesn't work was created yesterday.

Apparently, in that interval facebook added a new kind of permission - "upload_video". Even the app that worked never requested that permission, but it somehow uploaded the video regardless of it - maybe because of facebook's backwards compatibility.

The way I found this is by noticing that even the onComplete callback has a message, and in that message was the error. Very stupid SDK behavior in my opinion - if I had an error, why call onComplete() and not onFacebookError()?