2

I'm using FB API 3.0 for Android, and according to examples for Session I use

Request request = Request.newUploadPhotoRequest(Session.getActiveSession(), image, new Request.Callback();

to upload the image. I need to add some default text to this image, but I can't figure out where to put it.

In old API there was a bundle of parameters that were sent:

params.putByteArray("picture", imgData);
params.putString(Facebook.TOKEN, accessToken);
params.putString("caption", MyGlobals.INSTANCE.activeSetting.f_name);

What is the proper way to add text to Request for newUploadPhotoRequest?

tnx.

Balkyto
  • 1,460
  • 4
  • 22
  • 47

2 Answers2

7

After you create the request and before you execute it, you can do the following:

// Get the current parameters for the request
Bundle params = request.getParameters();
// Add the parameters you want, the caption in this case
params.putString("name", "My Caption String");
// Update the request parameters
request.setParameters(params);

// Execute the request
Request.executeBatchAsync(request);
C Abernathy
  • 5,533
  • 1
  • 22
  • 27
1

With the above solution we are unable to add description to image.

Solution:

replace name with message Because:

params.putString("name", "My Caption String");

putString first parameter is key for My caption String that key is unique one that unique was taken as message.

Sam R.
  • 16,027
  • 12
  • 69
  • 122
ramesh
  • 91
  • 1
  • 4