Share external object

Official Content
This documentation is valid for:

It is increasingly common for users to share information about an application with – or through – other applications (e.g. Instagram, Google+, Gmail, Hangouts, Dropbox) installed on the device. The Share external object allows you sharing content with any third-party application registered in the device to receive shared content.

Warning: Keep in mind that not all applications allow sharing any kind of content, been necessary to consider each case independently depending on each platform. Check Troubleshooting section for details.

Shareexternalobject-Location_png Share external object - Definition

Note: For specific social media sharing, Facebook and Twitter APIs are recommended.

Properties

It does not have any

Methods

ShareText method

Shares a text. Optionally, an URL and a title can be added (otherwise, leave them empty). 

Return value  None
Parameters text:VarChar(200) [ , url:URL ] [ , title:VarChar(200) ]
 

ShareImage method

It allows sharing an Image. Optionally, a text, an URL and a title can be attached to it.

Return value  None
Parameters image:Image [ , text:VarChar(200) ] [ , url:URL ] [ , title:VarChar(200) ]
 

Events

It does not have any

Example

In LightCRM, suppose we want users to share information about the meeting.

To do this, we add a “Share” button to the Application Bar of the Work with Meeting object.

SharingAPI - Layout

Next, we program the Event associated with this button.

Event 'Share'
    Composite
        If not CompanyLogo.IsEmpty()
            msg("Sharing meeting with image",status)
            Share.ShareImage(CompanyLogo, MeetingTitle,!"http://www.genexus.com",MeetingNote)
        Else
            msg("Sharing meeting",status)
            Share.ShareText(MeetingTitle,!"http://www.genexus.com",MeetingNote)
        EndIf
    EndComposite
EndEvent

The application will look as shown below. Clicking on the button displays a pop-up dialog that shows the applications installed on our device for sharing content. Lastly, you must to select one of these applications and share it!

SharingAPI - iOS button

Notes

  • Not all parameters specified in the methods will be shown in all applications when you share content, except for those that are required or accepted by the applications.
  • The URL parameter should be complete, following the format <scheme>://<domain>[<port>]/<path>. Otherwise, the URL is considered relative to the Service URL of the application. 

Troubleshooting

Not all third-party application accepts any kind of content. 

For example,

  • Facebook always is exposed as a "share-with" application but does not allow to share plain text, it only allows you sharing images and URLsbut not both at the same time.
  • WhatsApp allows you to share images only if text, title, and URL are empty; otherwise, the image will not be sent.
  • Twitter ignores title parameters.
  • GMail takes the title as the subject of the email and text as its content.

These limitations depend on every external application.

Scope

Platforms  Smart Devices (iOS, Android)

Availability

This external object is available as of GeneXus 15.

See also



Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.