Hello
Determining the source of a UWP app installation (Microsoft Store, sideload, or Visual Studio) directly from within the app can be challenging because the app’s code doesn’t inherently know where it was installed from. However, there are some indirect methods you could consider:
App Version or Package Name: You could use different version numbers or package names for the Store version and the sideload/dev build. Then, in your code, you can check the app’s version or package name using Windows.ApplicationModel.Package.Current.Id.Version or Windows.ApplicationModel.Package.Current.Id.Name respectively.
Compilation Symbols: You can define different compilation symbols for different build configurations in Visual Studio. For example, you might have a symbol like STORE defined for the Store build configuration, and check for this symbol in your code.
App Services: If your app communicates with a server, you could potentially have the app send some information about its installation when it first runs or at certain intervals. This would require user consent for privacy reasons.
Telemetry Data: If your app uses a telemetry service like Microsoft App Center or Google Analytics, you could send custom events to track from where the app was installed. This would also require user consent.
These methods can give you clues about the installation source, but they aren’t foolproof. A tech-savvy user could sideload an app package obtained from the Store, or modify the package name or version of a sideloaded app, for example. Always consider the privacy implications and get user consent if you’re collecting or transmitting any data. If you need a foolproof method, you may need to consider other options, such as licensing your software.
Best Regards,
Wesley Li