How to red an external file during the installation of an .appxbundle

99 views Asked by At

I want to distribute my UWP app using side-loading.

I have created the .appxbundle using Visual Studio, and also EV code-signed it.

So, when the user clicks on the .appxbundle file, my app is properly installed and the user can start working with it!

In this way, I can place such .appxbundle on my website, and the users can download and install it. Marvelous.

Now, I would like to customize each download, by adding a file with some tracking information to attribute a download e.g. to a specific ad campaign that I am running.

So my server can generate a ZIP file containing the .appxbundle and a little .txt file containing the tracking info (I need to generate a separate file because the signed .appxbundle takes too long - several minutes - to regenerate each time).

The user then unzips the ZIP file, clicks on the .appxbundle and installs the app.

The tricky part is that, during the installation of the app, I would like to copy the .txt file into the LocalState folder of the app that is being installed.

Is it possible?

How can I do that?

Thanks!

1

There are 1 answers

0
marv51 On BEST ANSWER

If your users are going to install the app by clicking a ms-appinstaller:// link, you can attach extra data using the activationUri.

This can be a custom URL scheme that you register for your app with any url parameters. The appinstaller will call this url once the app is installed.

We use this to pass login information to the app, like this:

ms-appinstaller:?source=https://localhost:8000/myApp.appinstaller&activationUri=my-app-track-install:?campaign=billboards

If your app registers for the my-app-track-install url scheme in the Appxmanifest, then from the apps perspective the first launch is then a url activation with the url you added as activationUri. In your case you would track the install, and then proceed to launch the app normally.

You can find more info on this in the example and remark for this (semi-related) api-documentation: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.package.getappinstallerinfo?view=winrt-19041