ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Mobile specific functions / URI functions
  • Miscellaneous
  • 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 system window to select or create a resource from:
  • the device file system,
  • the Cloud (Google Drive, Microsoft OneDrive, etc.)
  • one of the content managers installed on the device.
Example
AndroidAndroid Widget
// Open the system window to select an image or a pdf
UriResource is URI = URISelect(uriImage + TAB + "application/pdf")
IF NOT ErrorOccurred THEN
// Displays the name of the selected resource
Info(URIGetInfo(UriResource, uriInfoName))
END
iPhone/iPad
// Open the system window to select an image or a pdf
URISelect(MyProcURISelect, uriImage + TAB + "application/pdf")
 
INTERNAL PROCÉDURE MyProcURISelect(Success is boolean, Result1 is URI)
IF Success = True THEN
// Displays the name of the selected resource
ToastDisplay(URIGetInfo(Result1, uriInfoName))
END
END
WINDEV
URISelect(MyProcURISelect, uriAudio + TAB + uriImage + TAB + uriVidéo)
 
INTERNAL PROCÉDURE MyProcURISelect(Success is boolean, Result1 is URI)
IF Success = True THEN
// Displays the name of the selected resource
ToastDisplay(Result1.Value)
END
END
Syntax
WINDEVAndroidAndroid Widget

Selecting or creating a resource (synchronous code) Hide the details

<Result> = URISelect([<MIME types> [, <Mode> [, <Document name>]]])
<Result>: URI variable
  • URI that corresponds to the selected resource.
  • If an error occurs, the ErrorOccurred variable is set to True. To get more details on the error, use ErrorInfo.
<MIME types>: Optional character string or constant
  • List of MIME types of selectable files, separated by TAB.
  • One of the following constants:
    uriAudioAllows all types of audio files.
    uriImageAllows all types of image files.
    uriVideoAllows all types of video files.

    Remark: It is possible to concatenate constants by separating them with TAB.
If a specified MIME type is not known by the system, it will be ignored.
If this parameter is not specified, all files will be selectable.
AndroidAndroid Widget On Android, files that do not match the specified MIME types will be visible but users will not be able to select them.
<Mode>: Optional Integer constant
Selection mode:
uriCreateOpens the picker in "Creation" mode to create a new document. The default name of this document can be specified in <Document name>.
uriOpen
(Default value)
Opens the picker in "Open" mode to open an existing document.
<Document name>: Optional character string
Default name of the document to be created when the picker is open in creation mode. This parameter is taken into account only if <Mode> corresponds to the uriCreate constant.
WINDEVAndroidAndroid Widget iPhone/iPadIOS WidgetMac Catalyst

Selecting or creating a resource (asynchronous code) Hide the details

URISelect(<WLanguage procedure> [, <MIME types> [, <Mode> [, <Document name>]]])
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure ("callback") called for the selected file. This procedure is called when the user closes the URI selection window. For more details on this procedure, see Parameters of the procedure used by URISelect.
<MIME types>: Optional character string or constant
  • List of MIME types of selectable files, separated by TAB.
  • One of the following constants:
    uriAudioAllows all types of audio files.
    uriImageAllows all types of image files.
    uriVideoAllows all types of video files.

    Remark: It is possible to concatenate constants by separating them with TAB.
If a specified MIME type is not known by the system, it will be ignored.
If this parameter is not specified, all files will be selectable.
AndroidAndroid Widget On Android, files that do not match the specified MIME types will still be visible but the user will not be able to select them.
<Mode>: Optional Integer constant
WINDEVAndroidAndroid Widget Selection mode:
uriCreateOpens the picker in "Creation" mode to create a new document. The default name of this document can be specified in <Document name>.
uriOpen
(Default value)
Opens the picker in "Open" mode to open an existing document.
<Document name>: Optional character string
WINDEVAndroidAndroid Widget Default name of the document to be created when the picker is open in creation mode. This parameter is taken into account only if <Mode> corresponds to the uriCreate constant.
Remarks

Miscellaneous

  • To manage the URI returned by URISelect, use the URIxxx functions.
  • To retrieve additional information (name, size, MIME type) on the selected resource, use URIGetInfo.
  • AndroidAndroid Widget URISelect is only available on devices running Android 4.4 or later (API level 19).
    A fatal error occurs if the function is used with an earlier system version.
    To determine the version of Android the application is running on, use SysAndroidVersion.
  • WINDEV This function is mainly used to write multi-platform code.
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.
URISelect 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.
Business / UI classification: UI Code
Component: wd290java.dll
Minimum version required
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help