This functionality is currently in beta, meaning functionality isn’t yet finalized, and we’re looking forward to your feedback.
Applications can communicate with each other through a variety of ways. For example, you can use a custom URL scheme to launch one app from another one and invoke actions specified in the link, check out this blog post for understanding Survey123's custom URL scheme. You can also use the newly added inter-app communication functionality to pass text or a URL to another app. Inter-app communication functionality brings up the standard iOS, macOS or Android share sheet that allows you to share text or URL to other applications. For instance, instead of copying a URL, navigating and pasting URL into another app, you can easily share a URL in the source app by triggering share sheet using inter-app communication functionality. This blog post explains how to achieve this.
First of all, you need to enter data or copy data to the clipboard.
property url urlInfo: "https://appstudio.arcgis.com/"
Column {
spacing: 10
TextField {
id: inputText
placeholderText: "Enter some text"
}
Text {
id: sampleURL
text: urlInfo
}
Button {
id: copyURL
text: "Copy as URL"
onClicked: {
AppFramework.clipboard.copy(sampleURL.text)
}
}
}
Once data is entered or copied to the clipboard, you can use the AppFramework.clipboard.share(QJSValue) method to share text or a URL to other apps. The following code snippet shows how to share input text across apps.
//Share input text
TextField {
id: inputText
placeholderText: "Enter some text"
}
Button {
id: shareURLButton
text: "Share as Text"
onClicked: {
AppFramework.clipboard.share(inputText.text)
}
}
The following code demonstrates how to share a URL from clipboard.
// Share URL from clipboard
Text {
id: sampleURL
text: urlInfo
}
Button {
id: copyURL
text: "Copy as URL"
onClicked: {
AppFramework.clipboard.copy(sampleURL.text)
}
}
Button {
id: shareURL
text: "Share as URL"
onClicked: {
AppFramework.clipboard.share()
}
}
Inter-app Communication Sample App
The Inter-app Communication sample app is available on AppStudio Desktop. To create an app based on this sample, follow these steps:
This sample is also available in the appstudio-samples GitHub repo.
To learn more about Inter-app communication, check out the API Guide.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.