Interapp communication

The AppStudio AppFramework provides an InterAppCommunication plug-in, used for components that control interaction between your app and others. It's recommended that default apps be set up before using functionality to communicate with them. To use this functionality, you first need to include the following import statement:

Use dark colors for code blocksCopy
1
import ArcGIS.AppFramework.InterAppCommunication 1.0

For an example of this functionality, see the sample app available in ArcGIS AppStudio or in the AppStudio samples GitHub repository.

Email

Prior to AppStudio 3.1, integrating a prefilled email into your app was best done with the UrlInfo component, using the queryParameters property to pass a subject and body of an email through a mailto URL. The following code sample uses the UrlInfo component to create an email containing system details:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Button {
    text: "Generate Email"

    onClicked: {
        var urlInfo = AppFramework.urlInfo("mailto:example@example.com"), //Instantiates UrlInfo with an email address
            deviceDetails = [ //Collects information about both the device and app
                "%1: %2 (%3)".arg("Device OS").arg(Qt.platform.os).arg(AppFramework.osVersion),
                "%1: %2".arg("Device Locale").arg(Qt.locale().name),
                "%1: %2".arg("App Version").arg(app.info.version),
                "%1: %2".arg("AppStudio Version").arg(AppFramework.version),
            ];
        urlInfo.queryParameters = { //Uses queryParameters property to populate email subject and body
            "subject": "%1 %2".arg("Feedback for").arg(app.info.title),
            "body": "\n\n%1".arg(deviceDetails.join("\n"))
        };
        Qt.openUrlExternally(urlInfo.url); //Uses Qt framework to open constructed UrlInfo
    }
}

This approach is limited, as it does not allow addressing the email to more than one recipient or support attachments. AppStudio 3.1 introduced an EmailComposer component, specifically designed to open a prefilled draft email to the device's default email client.

The following code sample demonstrates using the EmailComposer component to create the same form email as the UrlInfo sample above, this time sent to multiple people using the cc and bcc properties.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
EmailComposer {
    id: emailcomposer
    to: "example@example.com"
    cc: ["example2@example.com", "example3@example.com"]
    bcc: "example4@example.com"
    subject: "Feedback for " + app.info.title
    body:
        "Device OS:" + Qt.platform.os + AppFramework.osVersion + "<p>" +
        "Device Locale:" + Qt.locale().name + "<p>" +
        "App Version:" + app.info.version + "<p>" +
        "AppStudio Version:" + AppFramework.version
    html: true
}

Button {
    id: openEmailButton
    text: qsTr("Generate Email")
    onClicked: {
        emailcomposer.show()
    }
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.