expo-location
Advanced tools
Comparing version 7.0.0 to 8.0.0
import { EventEmitter } from '@unimodules/core'; | ||
import { PermissionResponse as UMPermissionResponse, PermissionStatus } from 'unimodules-permissions-interface'; | ||
declare const LocationEventEmitter: EventEmitter; | ||
@@ -48,2 +49,13 @@ export interface ProviderStatus { | ||
} | ||
export { PermissionStatus }; | ||
export declare type PermissionDetailsLocationIOS = { | ||
scope: 'whenInUse' | 'always'; | ||
}; | ||
export declare type PermissionDetailsLocationAndroid = { | ||
scope: 'fine' | 'coarse' | 'none'; | ||
}; | ||
export interface PermissionResponse extends UMPermissionResponse { | ||
ios?: PermissionDetailsLocationIOS; | ||
android?: PermissionDetailsLocationAndroid; | ||
} | ||
interface LocationTaskOptions { | ||
@@ -104,2 +116,3 @@ accuracy?: LocationAccuracy; | ||
export declare function getCurrentPositionAsync(options?: LocationOptions): Promise<LocationData>; | ||
export declare function getLastKnownPositionAsync(): Promise<LocationData>; | ||
export declare function getHeadingAsync(): Promise<HeadingData>; | ||
@@ -118,3 +131,4 @@ export declare function watchHeadingAsync(callback: HeadingCallback): Promise<{ | ||
}>; | ||
export declare function requestPermissionsAsync(): Promise<void>; | ||
export declare function getPermissionsAsync(): Promise<PermissionResponse>; | ||
export declare function requestPermissionsAsync(): Promise<PermissionResponse>; | ||
export declare function hasServicesEnabledAsync(): Promise<boolean>; | ||
@@ -121,0 +135,0 @@ export declare function isBackgroundLocationAvailableAsync(): Promise<boolean>; |
import { EventEmitter, Platform, CodedError } from '@unimodules/core'; | ||
import { PermissionStatus, } from 'unimodules-permissions-interface'; | ||
import invariant from 'invariant'; | ||
import ExpoLocation from './ExpoLocation'; | ||
const LocationEventEmitter = new EventEmitter(ExpoLocation); | ||
export { PermissionStatus }; | ||
var LocationAccuracy; | ||
@@ -63,2 +65,5 @@ (function (LocationAccuracy) { | ||
} | ||
export async function getLastKnownPositionAsync() { | ||
return ExpoLocation.getLastKnownPositionAsync(); | ||
} | ||
// Start Compass Module | ||
@@ -307,4 +312,7 @@ // To simplify, we will call watchHeadingAsync and wait for one update To ensure accuracy, we wait | ||
} | ||
export async function getPermissionsAsync() { | ||
return await ExpoLocation.getPermissionsAsync(); | ||
} | ||
export async function requestPermissionsAsync() { | ||
await ExpoLocation.requestPermissionsAsync(); | ||
return await ExpoLocation.requestPermissionsAsync(); | ||
} | ||
@@ -311,0 +319,0 @@ // --- Location service |
{ | ||
"name": "expo-location", | ||
"version": "7.0.0", | ||
"version": "8.0.0", | ||
"description": "Allows reading geolocation information from the device. Your app can poll for the current location or subscribe to location update events.", | ||
@@ -52,3 +52,3 @@ "main": "build/Location.js", | ||
}, | ||
"gitHead": "4e13b3cb88d9205f14bee7764038ab2dd9ef1fbd" | ||
"gitHead": "ec7878b9ce54f2537721218ae0fe4017e4004806" | ||
} |
@@ -21,3 +21,3 @@ # expo-location | ||
``` | ||
npm install expo-location | ||
expo install expo-location | ||
``` | ||
@@ -27,2 +27,13 @@ | ||
Add `NSLocationAlwaysAndWhenInUseUsageDescription`, `NSLocationAlwaysUsageDescription` and `NSLocationWhenInUseUsageDescription` keys to your `Info.plist`: | ||
```xml | ||
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key> | ||
<string>Allow $(PRODUCT_NAME) to use your location</string> | ||
<key>NSLocationAlwaysUsageDescription</key> | ||
<string>Allow $(PRODUCT_NAME) to use your location</string> | ||
<key>NSLocationWhenInUseUsageDescription</key> | ||
<string>Allow $(PRODUCT_NAME) to use your location</string> | ||
``` | ||
Run `pod install` in the ios directory after installing the npm package. | ||
@@ -32,6 +43,11 @@ | ||
No additional set up necessary. | ||
Add `android.permission.ACCESS_COARSE_LOCATION` and `android.permission.ACCESS_FINE_LOCATION` permissions to your manifest (`android/app/src/main/AndroidManifest.xml`): | ||
```xml | ||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||
``` | ||
# Contributing | ||
Contributions are very welcome! Please refer to guidelines described in the [contributing guide]( https://github.com/expo/expo#contributing). |
import { EventEmitter, Platform, CodedError } from '@unimodules/core'; | ||
import { | ||
PermissionResponse as UMPermissionResponse, | ||
PermissionStatus, | ||
} from 'unimodules-permissions-interface'; | ||
import invariant from 'invariant'; | ||
@@ -59,2 +64,17 @@ | ||
export { PermissionStatus }; | ||
export type PermissionDetailsLocationIOS = { | ||
scope: 'whenInUse' | 'always'; | ||
}; | ||
export type PermissionDetailsLocationAndroid = { | ||
scope: 'fine' | 'coarse' | 'none'; | ||
}; | ||
export interface PermissionResponse extends UMPermissionResponse { | ||
ios?: PermissionDetailsLocationIOS; | ||
android?: PermissionDetailsLocationAndroid; | ||
} | ||
interface LocationTaskOptions { | ||
@@ -165,2 +185,6 @@ accuracy?: LocationAccuracy; | ||
export async function getLastKnownPositionAsync(): Promise<LocationData> { | ||
return ExpoLocation.getLastKnownPositionAsync(); | ||
} | ||
// Start Compass Module | ||
@@ -477,6 +501,10 @@ | ||
export async function requestPermissionsAsync(): Promise<void> { | ||
await ExpoLocation.requestPermissionsAsync(); | ||
export async function getPermissionsAsync(): Promise<PermissionResponse> { | ||
return await ExpoLocation.getPermissionsAsync(); | ||
} | ||
export async function requestPermissionsAsync(): Promise<PermissionResponse> { | ||
return await ExpoLocation.requestPermissionsAsync(); | ||
} | ||
// --- Location service | ||
@@ -483,0 +511,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
330377
47
1421
51