# react-native-location-enabler **Repository Path**: vbes/react-native-location-enabler ## Basic Information - **Project Name**: react-native-location-enabler - **Description**: React-Native监测GPS开关并提醒打开的辅助工具 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-05-17 - **Last Updated**: 2024-05-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # react-native-location-enabler [![GitHub version](https://badge.fury.io/gh/YsnKsy%2Freact-native-location-enabler.svg)](https://github.com/YsnKsy/react-native-location-enabler) [![npm version](https://badge.fury.io/js/react-native-location-enabler.svg)](https://www.npmjs.com/package/react-native-location-enabler/) ![Last Release](https://github.com/YsnKsy/react-native-location-enabler/workflows/Release/badge.svg) ![Pull Request](https://github.com/YsnKsy/react-native-location-enabler/workflows/Pull%20Request/badge.svg) [![GitHub issues](https://img.shields.io/github/issues/YsnKsy/react-native-location-enabler)](https://github.com/YsnKsy/react-native-location-enabler/issues) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/YsnKsy/react-native-location-enabler/blob/master/CONTRIBUTING.md) ![Platform - Android](https://img.shields.io/badge/platform-Android-green.svg) [![styled with Prettier](https://img.shields.io/badge/styled_with-Prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![GitHub license](https://img.shields.io/github/license/YsnKsy/react-native-location-enabler)](https://github.com/YsnKsy/react-native-location-enabler/blob/master/LICENSE) This package makes it easy for an React Native App to ensure that the Android device's system settings are properly configured for the app's location needs. If your app needs to request location, the device needs to enable the appropriate system settings, such as GPS or Wi-Fi scanning. Rather than directly enabling services such as the device's GPS, your app specifies the required level of accuracy/power consumption, and the device automatically makes the appropriate changes to system settings. --- ## Installation ```sh yarn add react-native-location-enabler ``` --- ## Usage ### Example using Hook (React Hooks API) : ```js import LocationEnabler from 'react-native-location-enabler'; const { PRIORITIES: { HIGH_ACCURACY }, useLocationSettings, } = LocationEnabler; // React Component const App = () => { const [enabled, requestResolution] = useLocationSettings( { priority: HIGH_ACCURACY, // default BALANCED_POWER_ACCURACY alwaysShow: true, // default false needBle: true, // default false }, false /* optional: default undefined */ ); return ( {!enabled && (