New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

cap-android-steps

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cap-android-steps

Capacitor plugin for tracking steps on Android devices.

latest
Source
npmnpm
Version
0.0.3
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

CapAndroidSteps

CapAndroidSteps

cap-android-steps

Capacitor plugin for counting steps on Android devices using the Android ACTIVITY_RECOGNITION permission or sensor. This plugin can function independently without requiring Health Connect.

Installation

npm install cap-android-steps
npx cap sync

Android

Ensure your app has the ACTIVITY_RECOGNITION permission in your AndroidManifest.xml for Android 10+ devices.

Configuration

No configuration required for this plugin.

Demo

TBD

Usage

import { CapAndroidSteps } from 'cap-android-steps';

const requestPermission = async () => {
  const result = await CapAndroidSteps.requestActivityRecognitionPermission();
  return result.granted;
};

const getStepsForPeriod = async (period: 'all') => {
  const result = await CapAndroidSteps.getStepsForPeriod({ period });
  return result.count;
};

const getRawSensorValues = async () => {
  const result = await CapAndroidSteps.getRawSensorValues();
  return result;
};

API

  • invertString(...)
  • requestActivityRecognitionPermission()
  • getStepsForPeriod(...)
  • getRawSensorValues()
  • Interfaces
  • Type Aliases

invertString(...)

invertString(options: InvertStringOptions) => Promise<InvertStringResult>

Inverts the provided string (reverses it). This method has nothing to do with screen orientation.

ParamType
optionsInvertStringOptions

Returns: Promise<InvertStringResult>

requestActivityRecognitionPermission()

requestActivityRecognitionPermission() => Promise<PermissionResult>

Requests the ACTIVITY_RECOGNITION permission on Android 10+ devices. This permission is required for step counting functionality.

Returns: Promise<PermissionResult>

getStepsForPeriod(...)

getStepsForPeriod(options?: StepPeriodOptions | undefined) => Promise<StepCountResult>

Gets the step count for a specified period. Requires activity recognition permission on Android 10+.

ParamType
optionsStepPeriodOptions

Returns: Promise<StepCountResult>

getRawSensorValues()

getRawSensorValues() => Promise<SensorValuesResult>

Gets the raw sensor values from the step counter sensor. Requires activity recognition permission on Android 10+.

Returns: Promise<SensorValuesResult>

Interfaces

InvertStringResult

PropTypeDescription
valuestringThe inverted string.

InvertStringOptions

PropTypeDescription
valuestringThe string to invert.

PermissionResult

PropTypeDescription
grantedbooleanWhether the permission was granted.

StepCountResult

PropTypeDescription
countnumberThe number of steps counted during the specified period.
period'hour' | 'day' | 'all'The period for which the step count was calculated.
startTimenumber | nullThe start time of the period in milliseconds. For 'all' period, this is the device boot time.
endTimenumberThe end time of the period in milliseconds (current time).

StepPeriodOptions

PropTypeDescription
period'hour' | 'day' | 'all'The period for which to get step data. Valid values are "hour", "day", or "all". - "hour": Steps taken in the last hour - "day": Steps taken in the last 24 hours - "all": All steps recorded since device boot (raw step counter value) Defaults to "day" if not specified.

SensorValuesResult

PropTypeDescription
valuesRecord<string, number>Object containing the raw sensor values. The step counter sensor typically only has one value at index "0", but this provides access to all values the sensor might report.
stepCountnumberThe step count value (same as values["0"] for convenience).
sensorNamestringThe name of the step counter sensor.
sensorVendorstringThe vendor of the step counter sensor.
sensorVersionnumberThe version of the step counter sensor.

Type Aliases

Record

Construct a type with a set of properties K of type T

{ [P in K]: T; }

License

See LICENSE.

Keywords

capacitor

FAQs

Package last updated on 10 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts