0

I'm using Delphi 10.1 Berlin for developing android apps and for this I have tried to implement sharing functionality using the following code:

procedure TBaseForm.ShareDataInAndroid;
var
  Intent: JIntent;
begin
  try
    Intent := TJIntent.Create;
    Intent.setType(StringToJString('text/plain'));
    Intent.setAction(TJIntent.JavaClass.ACTION_SEND);
    Intent.putExtra(TJIntent.JavaClass.EXTRA_TEXT, StringToJString('Delphi Rocks!!!'));
    MainActivity.startActivity(Intent);
  finally
  end;
end;

But the text Delphi Rocks!!! text is shared in all other apps but it is not getting added in facebook app. And please help me to fix this issue.

Also I have tried with the TShowShareSheetAction action event and this facebook occurs.

Thanks in advance.

test12345
  • 367
  • 1
  • 21
  • 2
    The problem is not with your code. Facebook simply does not support sharing text using Intents anymore. If you do a simple search, you would find several questions on StackOverflow that explain this issue. You must use Facebook's own SDK instead of an Intent. The [official Facebook documentation](https://developers.facebook.com/docs/sharing/android) even says so. – Remy Lebeau Jan 16 '17 at 06:57
  • But with this [link](http://stackoverflow.com/questions/20015410/customize-android-intent-action-send/20015435#20015435) they have mentioned for adding text in facebook. Can we implement same functionality using firemonkey? – test12345 Jan 17 '17 at 17:44
  • those answers are several years old. Things have changed since then. If you read the documentation I linked to, that is current. Facebook wants developers to use Facebook's SDK, not Android Intents. The only thing you can still post with an Intent is an image by itself, you can't post text anymore. Again, if you do a search, you will see numerous posts on StackOverflow that explain this issue and provide other solutions. – Remy Lebeau Jan 17 '17 at 18:15
  • Yeah. Thanks Remy – test12345 Jan 18 '17 at 03:57
  • Is there any option to hide only facebook icon while sharing the text? – test12345 Feb 24 '17 at 15:22

0 Answers0