{"id":16351791,"url":"https://github.com/jfversluis/plugin.maui.pedometer","last_synced_at":"2025-07-28T16:31:36.935Z","repository":{"id":189131694,"uuid":"679671805","full_name":"jfversluis/Plugin.Maui.Pedometer","owner":"jfversluis","description":"Plugin.Maui.Pedometer provides the ability to read the device pedometer in your .NET MAUI application. This plugin currently only supports iOS and Android.","archived":false,"fork":false,"pushed_at":"2023-08-18T12:25:11.000Z","size":8585,"stargazers_count":23,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-20T03:41:51.670Z","etag":null,"topics":["android","dotnet","dotnet-maui","ios","maui","pedometer","step-counter"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jfversluis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"jfversluis"}},"created_at":"2023-08-17T11:06:59.000Z","updated_at":"2024-11-15T10:27:51.000Z","dependencies_parsed_at":"2023-08-18T12:39:13.850Z","dependency_job_id":null,"html_url":"https://github.com/jfversluis/Plugin.Maui.Pedometer","commit_stats":null,"previous_names":["jfversluis/plugin.maui.pedometer"],"tags_count":2,"template":false,"template_full_name":"jfversluis/Plugin.Maui.Feature","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfversluis%2FPlugin.Maui.Pedometer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfversluis%2FPlugin.Maui.Pedometer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfversluis%2FPlugin.Maui.Pedometer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfversluis%2FPlugin.Maui.Pedometer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jfversluis","download_url":"https://codeload.github.com/jfversluis/Plugin.Maui.Pedometer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227852007,"owners_count":17829451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","dotnet","dotnet-maui","ios","maui","pedometer","step-counter"],"created_at":"2024-10-11T01:24:03.649Z","updated_at":"2024-12-03T13:57:20.273Z","avatar_url":"https://github.com/jfversluis.png","language":"C#","funding_links":["https://github.com/sponsors/jfversluis"],"categories":[],"sub_categories":[],"readme":"![](nuget.png) \n# Plugin.Maui.Pedometer\n\n`Plugin.Maui.Pedometer` provides the ability to read the device pedometer in your .NET MAUI application. This plugin currently only supports iOS and Android.\n\n## Install Plugin\n\n[![NuGet](https://img.shields.io/nuget/v/Plugin.Maui.Pedometer.svg?label=NuGet)](https://www.nuget.org/packages/Plugin.Maui.Pedometer/)\n\nAvailable on [NuGet](http://www.nuget.org/packages/Plugin.Maui.Pedometer).\n\nInstall with the dotnet CLI: `dotnet add package Plugin.Maui.Pedometer`, or through the NuGet Package Manager in Visual Studio.\n\n## API Usage\n\n`Plugin.Maui.Pedometer` provides the `Pedometer` class that can be used to monitor the device pedometer and track the user's step count.\n\n### Permissions\n\nBefore you can start reading pedometer values, you will need to request the proper permissions on each platform.\n\n#### iOS\n\nOn iOS, add the `NSMotionUsageDescription` key to your `info.plist` file. When declared, the permission will be requested automatically at runtime.\n\n```xml\n\u003ckey\u003eNSMotionUsageDescription\u003c/key\u003e\n\u003cstring\u003eThis app wants to track your pedometer readings\u003c/string\u003e\n```\n\n#### Android\n\nOn Android with API 29+, declare the `ACTIVITY_RECOGNITION` permissions in your `AndroidManifest.xml` file. This should be placed in the `manifest` node. You can also add this through the visual editor in Visual Studio.\n\nThe runtime permission is automatically requested by the plugin when `Start()` is called.\n\n```xml\n\u003cuses-permission android:name=\"android.permission.ACTIVITY_RECOGNITION\" /\u003e\n```\n\n### Dependency Injection\n\nYou will first need to register the `Pedometer` with the `MauiAppBuilder` following the same pattern that the .NET MAUI Essentials libraries follow.\n\n```csharp\nbuilder.Services.AddSingleton(Pedometer.Default);\n```\n\nYou can then enable your classes to depend on `IPedometer` as per the following example.\n\n```csharp\npublic class StepCounterViewModel\n{\n    readonly IPedometer pedometer;\n\n    public StepCounterViewModel(IPedometer pedometer)\n    {\n        this.pedometer = pedometer;\n    }\n\n    public void StartCounting()\n    {\n        pedometer.ReadingChanged += (sender, reading) =\u003e\n        {\n            Console.WriteLine(reading.NumberOfSteps);\n        };\n\n        pedometer.Start();\n    }\n}\n```\n\n### Straight usage\n\nAlternatively if you want to skip using the dependency injection approach you can use the `Pedometer.Default` property.\n\n```csharp\npublic class StepCounterViewModel\n{\n    public void StartCounting()\n    {\n        pedometer.ReadingChanged += (sender, reading) =\u003e\n        {\n            Console.WriteLine(reading.NumberOfSteps);\n        };\n\n        Pedometer.Default.Start();\n    }\n}\n```\n\n### Pedometer\n\nOnce you have created a `Pedometer` you can interact with it in the following ways:\n\n#### Events\n\n##### `ReadingChanged`\n\nOccurs when pedometer reading changes.\n\n#### Properties\n\n##### `IsSupported`\n\nGets a value indicating whether reading the pedometer is supported on this device.\n\n##### `IsMonitoring`\n\nGets a value indicating whether the pedometer is actively being monitored.\n\n#### Methods\n\n##### `Start()`\n\nStart monitoring for changes to the pedometer.\n\n##### `Stop()`\n\nStop monitoring for changes to the pedometer.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfversluis%2Fplugin.maui.pedometer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjfversluis%2Fplugin.maui.pedometer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfversluis%2Fplugin.maui.pedometer/lists"}