Skip to content

Commit

Permalink
Variable for Require GPS Hardware (#189)
Browse files Browse the repository at this point in the history
* Variable for Require GPS Hardware

* docs: wording changes for installation

Co-authored-by: Martin Bech <mb@mobaro.com>
Co-authored-by: Tim Brust <ratchet.player@gmx.de>
  • Loading branch information
3 people committed Mar 18, 2020
1 parent 6570cf9 commit 89cf51d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -172,6 +172,11 @@ error, the `geolocationError` callback is passed a

### Android Quirks

For historic reasons, this plugin requires GPS Hardware on Android devices, so your app will not be able to run on devices without.
If you want to use this plugin in your app, but you do not require actual GPS Hardware on the device, install the plugin using the variable *GPS_REQUIRED* set to false:

cordova plugin add cordova-plugin-geolocation --variable GPS_REQUIRED="false"

If Geolocation service is turned off the `onError` callback is invoked after `timeout` interval (if specified).
If `timeout` parameter is not specified then no callback is called.

Expand Down
3 changes: 2 additions & 1 deletion plugin.xml
Expand Up @@ -34,14 +34,15 @@ xmlns:android="http://schemas.android.com/apk/res/android"
<engines>
<engine name="cordova-android" version=">=6.3.0" />
</engines>
<preference name="GPS_REQUIRED" default="true"/>

<!-- android -->
<platform name="android">

<config-file target="AndroidManifest.xml" parent="/*">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.location.gps" />
<uses-feature android:name="android.hardware.location.gps" android:required="$GPS_REQUIRED" />
</config-file>

<config-file target="res/xml/config.xml" parent="/*">
Expand Down

0 comments on commit 89cf51d

Please sign in to comment.