Skip to content

Module for making sure location services are turned on for an app

License

Notifications You must be signed in to change notification settings

JPig/react-native-require-location

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Native Location Services Requiring

a React Native module for requiring location services be enabled or turned on

Installation

  1. npm install react-native-require-location --save
  2. react-native link react-native-require-location

Usage

  import LocationServicesRequired from 'react-native-require-location';
  
  LocationServicesRequired.showSettings({
    message: "<h2>Use Location ?</h2>This app wants to change your device settings:<br/><br/>Use GPS, Wi-Fi, and cell network for location<br/><br/>",
    ok: "YES",
    cancel: "NO"
  }).then(success => {
    
    //can attempt to access location now
    
  }).catch(error => {
      
    //handle error
    
  }); 
  

Notes

the package will auto "close" (it will put the app to the background) the app hinting to the user that location is required to use the app

About

Module for making sure location services are turned on for an app

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published