In many apps, it is useful to track app launches for scenarios like:
n launches)Especially the first use case is quite common, and it would help avoid re-writing the same code repeatedly.
Originally created as a PR to Uno Platform and blogged about it here, but realized it would be useful as a general UWP helper, and Uno would get it via Uno.WindowsCommunityToolkit. The code is partially based on VersionTracking API in Xamarin.Essentials, but includes additional properties.
The current LaunchTracker API has the following API surface:
static Current - lazily initializes an instance of LaunchTrackerTrack() - a "no-op" that can be called to ensure the instance is createdIsFirstLaunch - checks if the launch is the first everIsFirstLaunchForCurrentVersion - checks if the launch is the first for current versionIsFirstLaunchForCurrentBuild - checks if the launch is first for current buildLaunchCount - number of launchesCurrentLaunchDate - current launch datePreviousLaunchDate - previous launch datePreviousLaunchedVersion - previous version that was launchedPreviousLaunchedBuild - previous build that was launchedFirstLaunchedVersion - first version that was launchedFirstLaunchedBuild - first build that was launchedCurrentVersion - current package versionCurrentBuild - current package buildVersionHistory - list of versions that were launchedBuildHistory - list of builds that were launchedIsFirstLaunchForVersion(version) - checks if this is the first launch for given versionIsFirstLaunchForBuild(build) - checks if this is the first launch for given buildSome of the APIs could potentially be removed - like the -Build related ones, I don't expect that functionality to be used too often.
Didn't find similar APIs in WCT, hope I didn't miss something :-) .
Hello, 'MartinZikmund! Thanks for submitting a new feature request. I've automatically added a vote 馃憤 reaction to help get things started. Other community members can vote to help us prioritize this feature in the future!
@MartinZikmund we've had helpers in the Toolkit for a while here in the SystemInformation class.
I'm pretty sure these are also ported as part of the Uno fork of the Toolkit here.
Is there anything we're missing that we can unify on here in the Toolkit instead?
Ha :-D ! How did I miss that :-D ?!
What could be added there would be the version history, but since everything else is in place, that probably does not bring that much value.
@michael-hawker Also time to update my blogpost with this newfound knowledge then 馃榾 .
@MartinZikmund no worries! I think the toolkit's gotten to the point where it's probably impossible for one person to know everything that's in it! 馃構
My go to guidance is usually just 'check the toolkit first' now. 馃檪 However, if this was hard to find, we should probably open up an issue on our docs repo and figure out how we can optimize the article here, I could pull in some docs folks over there. Maybe add some info in it like what type of search queries you tried.