Configure UWP Native Messagging App

128 views Asked by At


I'd like to configure an UWP App in order to receive messages from an Edge Extension, and to answer to these messages using some external configurations: I tried to use the Windows Credentials Vault, but it seems impossible to access it (the UWP App seems running in a SandBox), with no visibility of the Windows Credential Vault).
So my question is: is there a way to manually configure an UWP app without deploying the configuration into the store?

Thanks so much,
Daniele

1

There are 1 answers

0
Daniele Milani On BEST ANSWER

I don't know if this is the best option, but an UWP app can read a file from the local storage.
So, after the installation took place, I wrote a config file in the local storage directory (%USERPROFILE%\AppData\Local\Packages\\LocalState), and I was able to access it from the UWP app using the following code:

Windows.Storage.StorageFolder storageFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
Windows.Storage.StorageFile configFile = await storageFolder.GetFileAsync("config");
String configContent = await Windows.Storage.FileIO.ReadTextAsync(configFile);
//configContent now contains the config info