UNPKG

2.4 kBTypeScriptView Raw
1/**
2 * @name Stepcounter
3 * @description
4 * Cordova plugin for using device's stepcounter on Android (API > 19)
5 *
6 * Use to
7 * - start and stop stepcounter service
8 * - read device's stepcounter data
9 *
10 * @usage
11 * ```
12 * import { Stepcounter } from 'ionic-native';
13 *
14 * let startingOffset = 0;
15 * Stepcounter.start(startingOffset).then(onSuccess => console.log('stepcounter-start success', onSuccess), onFailure => console.log('stepcounter-start error', onFailure));
16 *
17 * Stepcounter.getHistory().then(historyObj => console.log('stepcounter-history success', historyObj), onFailure => console.log('stepcounter-history error', onFailure));
18 *
19 * ```
20 */
21export declare class Stepcounter {
22 /**
23 * Start the step counter
24 *
25 * @param startingOffset {number} will be added to the total steps counted in this session
26 * @returns {Promise<any | number>} Returns a Promise that resolves on success or rejects on failure
27 */
28 static start(startingOffset: number): Promise<number | any>;
29 /**
30 * Stop the step counter
31 * @returns {Promise<any | number>} Returns a Promise that resolves on success with the amount of steps since the start command has been called, or rejects on failure
32 */
33 static stop(): Promise<number | any>;
34 /**
35 * Get the amount of steps for today (or -1 if it no data given)
36 * @returns {Promise<any | number>} Returns a Promise that resolves on success with the amount of steps today, or rejects on failure
37 */
38 static getTodayStepCount(): Promise<number | any>;
39 /**
40 * Get the amount of steps since the start command has been called
41 * @returns {Promise<any | number>} Returns a Promise that resolves on success with the amount of steps since the start command has been called, or rejects on failure
42 */
43 static getStepCount(): Promise<number | any>;
44 /**
45 * Returns true/false if Android device is running >API level 19 && has the step counter API available
46 * @returns {Promise<any | boolean>} Returns a Promise that resolves on success, or rejects on failure
47 */
48 static deviceCanCountSteps(): Promise<boolean | any>;
49 /**
50 * Get the step history (JavaScript object)
51 * @returns {Promise<any>} Returns a Promise that resolves on success, or rejects on failure
52 */
53 static getHistory(): Promise<any>;
54}