How to assign custom label to child app?

I have a custom app I am creating. it has one main app, and one child app (multiple-instances).

The code looks like this in the main app:

preferences {
    page(name: "mainPage", title: "Simple Parent app", install: true, uninstall: true) {
        section("Installed Children") {
            app(name: "childApps", appName: "Simple Child Provider", namespace: "apwelsh", title: "Add New Simple Child Provider", multiple: true)
        }
    }
}

Every child app that gets created using this mechanism shares the same exact name. I would like to set the label, but the childApp reports setLabel is not a support function (more vaguely than that).

Is the only way to name child apps, is if I manually create/add the child app, and assign the label at the time of creation?

Looks like by default it is the third parameter of the addChildApp method

chd = addChildApp("thebearmay", "Device Attribute Iterative Storage - Acquisition", "DAIS ${new Date().getTime()}")

Not a lot of detail in the documentation (App Object | Hubitat Documentation) but the full pattern is:

  • InstalledAppWrapper addChildApp(String namespace, String name, String label, Map properties = null)

you can also let the user rename the child app, by adding this to the child app preferences

            label title: "Set App Label", required: false
4 Likes

Thanks. I am familiar with the manually adding child apps method. That's what I do with other code I have. What I was asking is specifically for the app() mechanism that lets you handle this automatically. I am trying to see if I can do this with minimal code, instead of the way I have been doing this with an iterator of decorated hrefs.