AppStat 0.0.9

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package AppStat --version 0.0.9
NuGet\Install-Package AppStat -Version 0.0.9
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AppStat" Version="0.0.9" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AppStat --version 0.0.9
#r "nuget: AppStat, 0.0.9"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AppStat as a Cake Addin
#addin nuget:?package=AppStat&version=0.0.9

// Install AppStat as a Cake Tool
#tool nuget:?package=AppStat&version=0.0.9

Android required permissions: PackageUsageStats (user of app must also go to settings and allow usage access under special permissions)

For UWP apps add this to your app manifest:

xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"

add rescap to ignorable namespaces.

Then add:

<rescap:Capability Name="appDiagnostics"/>

Then the user of the app has to go to settings find the app and toggle app diagnostics.

set_app_time_callback recieves app_times and boolean value indiciating wether the values are relative or absolute. Only android returns non-relative values, that is total applicaion usage times, 10 years back in time. And gives results as milliseconds while all other values are measured in seconds.

Note that macOS and WPF measures time that application is in the foreground, while UWP measures time that applicaion is active or not suspended. To measure usage times on windows, use WPF rather than UWP, since UWP can only measure UWP applications.

To launch monitoring for open apps on UWP you must run the run function. It will only record appdiagnostics for open applications, to continoually record diagnostics for applications that are launched, the run function must be called multiple times. (monitor interval is not used on uwp)

WPF display/monitor status can be set with the following code:

		SystemEvents.SessionSwitch += (s, e) => {
			if(e.Reason == SessionSwitchReason.SessionLock) {
				this.monitor.set_display_status(false);
			} else {
				this.monitor.set_display_status(true);
			}
		};

log_usage is not used in this version but is intended if you wish to log every log entry directly to database.

notes on switch type for log usage:

switch_type 1: logging has just started, (do not add time difference between last log value and this log value) switch_type 2: (screen is locked, do not add time difference between this log value and next log value) switch_type 0: normal log value.

        this.monitor = new monitor();
        await monitor.set_monitor(async (s) => {
            System.Diagnostics.Debug.WriteLine("device_id: "+s);
            //place code here that registers device_id into backend code
            return true;
        }, async (Dictionary<string, usage_time> usage_times_values, bool relative) => {
            //place code here that saves to database or file
            return true;
        }, 500);
        this.run();
Product Compatible and additional computed target framework versions.
.NET net6.0-android was computed.  net7.0-android was computed.  net8.0-android was computed. 
.NET Framework net is compatible.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid is compatible. 
Universal Windows Platform netcore50 is compatible. 
Xamarin.Mac xamarinmac is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated