PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Special cases
  • Application in the background: Specific case from Android 10
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Opens a popup allowing you to select the application that will be used to share a resource (text or document). The application will be opened with the specified resource.
For example, an image can be shared with the application for sending emails. In this case, a new email will be created with the specified image in attachment.
Versions 21 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
iPhone/iPad This function is now available for iPhone/iPad applications.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
iPhone/iPad This function is now available for iPhone/iPad applications.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
AndroidAndroid Widget
// Share an image displayed in an Image control
sPath is string = CompleteDir(SysDirStorageCard()) + "MyImage.png"
IF dSaveImagePNG(IMG_Image, sPath) = True THEN
NextTitle("Sharing an image")
StartShare(sPath)
END
iPhone/iPad
// Share an image displayed in an Image control
sPath is string = CompleteDir(fDataDir()) + "MyImage.png"
IF dSaveImagePNG(IMG_Image, sPath) = True THEN
NextTitle("Sharing an image")
StartShare(sPath)
END
// Share a text displayed in an edit control
IF StartShare(shareText, EDT_Edit) = False THEN
Error(ErrorInfo())
END
Syntax
<Result> = StartShare([<Type>, ] <Parameter 1> [, <Parameter 2> [... [, <Parameter N>]]])
<Result>: Boolean
  • True if the specified resources can be shared.
    Remarks:
    • This function is not locking: the code that follows the call to this function will continue to run as soon as the popup is displayed.
    • It is not possible to find out whether an application was selected by the user to perform the share.
  • False if no application allowing to share the resources is found. To get the details of the error, use ErrorInfo.
<Type>: Optional Integer constant
Type of resource to share:
shareDocument
(Default value)
One or more documents (image, video, pdf, ...) are shared. These documents are identified by their full path, specified as parameter (<Parameter 1> to <Parameter N>).
The document must be located in the shared memory of the device (for example: the SDCard) in order to be used by the external application selected for the share.
iPhone/iPad Only the images are supported.
shareTextText is shared.
If several character strings are specified as parameters (<Parameter 1> to <Parameter N>), they are concatenated and separated by carriage returns (CR).
Android Caution: The Facebook application does not allow you to share text automatically.
<Parameter 1>: Character string
First resource to share. Corresponds to:
  • a file path (if the shareDocument constant is used).
  • a character string (if the shareText constant is used).
<Parameter 2>: Optional character string
Second resource to share. Corresponds to:
  • a file path (if the shareDocument constant is used).
  • a character string (if the shareText constant is used).
<Parameter N>: Optional character string
Last resource to share. Corresponds to:
  • a file path (if the shareDocument constant is used).
  • a character string (if the shareText constant is used).
Remarks

Special cases

  • To customize the title of popup for selecting the application, use NextTitle before StartShare.
  • If only one application lets you share the resource on the mobile, the popup is not displayed and the application starts directly.
  • Android Caution: This function is available in the Android emulator. This function is not available in the Android simulator.
Versions 25 and later
AndroidAndroid Widget

Application in the background: Specific case from Android 10

From Android 10, it is no longer possible to open a window when the application is in the background.
StartShare can open a window. If this function is used while the application is in the background, a fatal error will occur.
Tips:
  • It is possible to determine if the application is in the background using InBackgroundMode.
  • If an application needs to interact with the user while it is in the background, the solution is to display a notification (via the Notification type). The application will be brought back to the foreground when the notification is clicked, if the ActivateApplication property is set to True. You can also open a window from the procedure passed to the ActionClick property.
New in version 25
AndroidAndroid Widget

Application in the background: Specific case from Android 10

From Android 10, it is no longer possible to open a window when the application is in the background.
StartShare can open a window. If this function is used while the application is in the background, a fatal error will occur.
Tips:
  • It is possible to determine if the application is in the background using InBackgroundMode.
  • If an application needs to interact with the user while it is in the background, the solution is to display a notification (via the Notification type). The application will be brought back to the foreground when the notification is clicked, if the ActivateApplication property is set to True. You can also open a window from the procedure passed to the ActionClick property.
AndroidAndroid Widget

Application in the background: Specific case from Android 10

From Android 10, it is no longer possible to open a window when the application is in the background.
StartShare can open a window. If this function is used while the application is in the background, a fatal error will occur.
Tips:
  • It is possible to determine if the application is in the background using InBackgroundMode.
  • If an application needs to interact with the user while it is in the background, the solution is to display a notification (via the Notification type). The application will be brought back to the foreground when the notification is clicked, if the ActivateApplication property is set to True. You can also open a window from the procedure passed to the ActionClick property.
Component: wd270android.aar
Minimum version required
  • Version 18
This page is also available for…
Comments
Click [Add] to post a comment