UNPKG

2.3 kBTypeScriptView Raw
1/**
2 * @name LocationAccuracy
3 * @description
4 * This Cordova/Phonegap plugin for Android and iOS to request enabling/changing of Location Services by triggering a native dialog from within the app, avoiding the need for the user to leave your app to change location settings manually.
5 *
6 * @usage
7 * ```
8 * import { LocationAccuracy } from 'ionic-native';
9 *
10 * LocationAccuracy.canRequest().then((canRequest: boolean) => {
11 *
12 * if(canRequest) {
13 * // the accuracy option will be ignored by iOS
14 * LocationAccuracy.request(LocationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).then(
15 * () => console.log('Request successful'),
16 * error => console.log('Error requesting location permissions', error)
17 * );
18 * }
19 *
20 * });
21 *
22 * ```
23 */
24export declare class LocationAccuracy {
25 /**
26 * Indicates if you can request accurate location
27 * @returns {Promise<boolean>} Returns a promise that resovles with a boolean that indicates if you can request accurate location
28 */
29 static canRequest(): Promise<boolean>;
30 /**
31 * Indicates if a request is currently in progress
32 * @returns {Promise<boolean>} Returns a promise that resolves with a boolean that indicates if a request is currently in progress
33 */
34 static isRequesting(): Promise<boolean>;
35 /**
36 * Requests accurate location
37 * @param accuracy {number} Accuracy, from 0 to 4. You can use the static properties of this class that start with REQUEST_PRIORITY_
38 * @returns {Promise<any>} Returns a promise that resolves on success and rejects if an error occurred
39 */
40 static request(accuracy: number): Promise<any>;
41 static REQUEST_PRIORITY_NO_POWER: number;
42 static REQUEST_PRIORITY_LOW_POWER: number;
43 static REQUEST_PRIORITY_BALANCED_POWER_ACCURACY: number;
44 static REQUEST_PRIORITY_HIGH_ACCURACY: number;
45 static SUCCESS_SETTINGS_SATISFIED: number;
46 static SUCCESS_USER_AGREED: number;
47 static ERROR_ALREADY_REQUESTING: number;
48 static ERROR_INVALID_ACTION: number;
49 static ERROR_INVALID_ACCURACY: number;
50 static ERROR_EXCEPTION: number;
51 static ERROR_CANNOT_CHANGE_ACCURACY: number;
52 static ERROR_USER_DISAGREED: number;
53 static ERROR_GOOGLE_API_CONNECTION_FAILED: number;
54}