{"id":15305180,"url":"https://github.com/eddyverbruggen/nativescript-pedometer","last_synced_at":"2025-06-13T20:39:26.121Z","repository":{"id":57148737,"uuid":"69187157","full_name":"EddyVerbruggen/nativescript-pedometer","owner":"EddyVerbruggen","description":":feet: step count tracking plugin for your NativeScript app","archived":false,"fork":false,"pushed_at":"2018-10-28T16:10:07.000Z","size":2153,"stargazers_count":20,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-18T22:34:45.863Z","etag":null,"topics":["nativescript","pedometer","stepcount"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EddyVerbruggen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-25T19:55:21.000Z","updated_at":"2025-02-26T16:49:14.000Z","dependencies_parsed_at":"2022-08-31T20:02:36.000Z","dependency_job_id":null,"html_url":"https://github.com/EddyVerbruggen/nativescript-pedometer","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/EddyVerbruggen/nativescript-pedometer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-pedometer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-pedometer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-pedometer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-pedometer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EddyVerbruggen","download_url":"https://codeload.github.com/EddyVerbruggen/nativescript-pedometer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EddyVerbruggen%2Fnativescript-pedometer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259718051,"owners_count":22901177,"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":["nativescript","pedometer","stepcount"],"created_at":"2024-10-01T07:59:30.053Z","updated_at":"2025-06-13T20:39:26.086Z","avatar_url":"https://github.com/EddyVerbruggen.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NativeScript Pedometer plugin\n\n\u003cimg src=\"https://raw.githubusercontent.com/EddyVerbruggen/nativescript-pedometer/master/media/tie-shoes.jpg\" width=\"310px\"/\u003e\n\n## Supported platforms\n* iOS 8 (the newer the OS the more features are available)\n* Android, any device with a step counter sensor\n\n## Installation\nFrom the command prompt go to your app's root folder and execute:\n\n```\ntns plugin add nativescript-pedometer\n```\n\n## Demo app\nWant to dive in quickly? Check out [the demo app](demo)! Otherwise, continue reading.\n\nYou can run the demo app from the root of the project by typing `npm run demo.ios.device` and you'll see this:\n\n\u003cimg src=\"https://raw.githubusercontent.com/EddyVerbruggen/nativescript-pedometer/master/media/demo.png\" width=\"375px\"/\u003e\n\n\n## API\n\n### `isStepCountingAvailable`\nThe key feature of this plugin is counting steps. And it's also the only feature that Android supports.\n\n##### TypeScript\n```js\n// require the plugin\nimport { Pedometer } from \"nativescript-pedometer\";\n\n// instantiate the plugin\nlet pedometer = new Pedometer();\n\npedometer.isStepCountingAvailable().then(avail =\u003e {\n  alert(avail ? \"Yes\" : \"No\");\n});\n```\n\n##### JavaScript\n```js\n// require the plugin\nvar Pedometer = require(\"nativescript-pedometer\").Pedometer;\n\n// instantiate the plugin\nvar pedometer = new Pedometer();\n\npedometer.isStepCountingAvailable(function(avail) {\n  alert(avail ? \"Yes\" : \"No\");\n});\n```\n\n\u003e Providing only TypeScript examples from here on out, but usage it largely similar. Also, I'm leaving out the Promises where they don't add clarity to the code sample.\n\n### `startUpdates`\nTo start receiving step count updates from this moment forward you can invoke `startUpdates`.\nIf you want historic data on iOS, pass in a custom `fromDate`.\n\n```js\npedometer.startUpdates({\n  fromDate: new Date(), // iOS only. Optional, default: now\n  onUpdate: result =\u003e {\n    // see the table below\n    console.log(`Pedometer update: ${JSON.stringify(result)}`);\n  }\n}).then(() =\u003e {\n  console.log(\"Pedometer updates started.\");\n}, err =\u003e {\n  console.log(\"Error: \" + err);\n});\n```\n\nThe `onUpdate` callback receives an object containing these properties:\n\n| Property | iOS? | Android? | Description |\n--- | --- | --- | ---\n| startDate | :white_check_mark: | :white_check_mark: | This is when recording of the currently returned data was started. |\n| endDate | :white_check_mark: | :white_check_mark: | This is when recording of the currently returned data was ended (usually: now). |\n| steps | :white_check_mark: | :white_check_mark: | Step count between startDate and endDate |\n| distance | :white_check_mark: | :white_medium_square: | The distance covered in meters between startDate and endDate. |\n| floorsAscended | :white_check_mark: | :white_medium_square: | The number of floors ascended between startDate and endDate. |\n| floorsDescended | :white_check_mark: | :white_medium_square: | The number of floors descended between startDate and endDate. |\n| currentPace | :white_check_mark: iOS9+ | :white_medium_square: | The current pace in seconds per meter. |\n| currentCadence | :white_check_mark: iOS9+ | :white_medium_square: | The current cadence in steps per second. |\n| averageActivePace | :white_check_mark: iOS10+ | :white_medium_square: | The average pace while active in seconds per meter between startDate and endDate. |\n\nIf you want to check beforehand if things like `currentPace` are available,\nthere's a few functions similar to `isStepCountingAvailable` that you can invoke:\n\n* `isDistanceAvailable`\n* `isFloorCountingAvailable`\n* `isPaceAvailable`\n* `isCadenceAvailable`\n\n### `stopUpdates`\nYou can wire up a Promise but there's no real need.\n\n```js\npedometer.stopUpdates();\n```\n\n### `query` (iOS)\nInstead of listening to \"live\" updates you can query historic data:\n\n```js\npedometer.query({\n  fromDate: new Date(new Date().getTime() - (1000 * 60 * 60)),\n  toDate: new Date() // default\n}).then(result =\u003e {\n  // see the table at 'startUpdates' above\n  console.log(`Pedometer update: ${JSON.stringify(result)}`);\n});\n```\n\n### `startEventUpdates` (iOS)\nFrom iOS 10 onwards it's possible to get notified whenever the device detects a switch\nbetween a 'paused' and 'resumed' state (so starting/stopping walking).\n\nTo check beforehand whether or not this feature is availbe,\ncall `isEventTrackingAvailable` (which has a similar API to `isStepCountingAvailable`).\n\n```js\npedometer.startEventUpdates({\n  onUpdate: result =\u003e {\n    // see the table below\n    console.log(\"Pedometer event update: \" + JSON.stringify(result));\n  }\n}).then(() =\u003e {\n  console.log(\"Pedometer event updates started.\");\n);\n```\n\nThe `onUpdate` callback receives an object containing these properties:\n\n| Property | Description |\n--- | ---\n| date | The moment the event occured. |\n| type | Either \"pause\" or \"resume\". |\n\n## Changelog\n* 2.0.0  Android support added.\n* 1.0.0  Initial release, iOS only, but full featured.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddyverbruggen%2Fnativescript-pedometer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddyverbruggen%2Fnativescript-pedometer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddyverbruggen%2Fnativescript-pedometer/lists"}