-
Notifications
You must be signed in to change notification settings - Fork 592
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: jcesarmobile <[email protected]> Co-authored-by: Dan Imhoff <[email protected]> Co-authored-by: Ian Keith <[email protected]>
- Loading branch information
1 parent
95203f4
commit 911ae71
Showing
43 changed files
with
2,452 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
build | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# node files | ||
dist | ||
node_modules | ||
|
||
# iOS files | ||
Pods | ||
Podfile.lock | ||
Build | ||
xcuserdata | ||
|
||
# macOS files | ||
.DS_Store | ||
|
||
|
||
|
||
# Based on Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore | ||
|
||
# Built application files | ||
*.apk | ||
*.ap_ | ||
|
||
# Files for the ART/Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Generated files | ||
bin | ||
gen | ||
out | ||
|
||
# Gradle files | ||
.gradle | ||
build | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard | ||
|
||
# Log Files | ||
*.log | ||
|
||
# Android Studio Navigation editor temp files | ||
.navigation | ||
|
||
# Android Studio captures folder | ||
captures | ||
|
||
# IntelliJ | ||
*.iml | ||
.idea | ||
|
||
# Keystore files | ||
# Uncomment the following line if you do not want to check your keystore files in. | ||
#*.jks | ||
|
||
# External native build folder generated in Android Studio 2.2 and later | ||
.externalNativeBuild |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
build | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'json' | ||
|
||
package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) | ||
|
||
Pod::Spec.new do |s| | ||
s.name = 'CapacitorGeolocation' | ||
s.version = package['version'] | ||
s.summary = package['description'] | ||
s.license = package['license'] | ||
s.homepage = package['repository']['url'] | ||
s.author = package['author'] | ||
s.source = { :git => package['repository']['url'], :tag => s.version.to_s } | ||
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}' | ||
s.ios.deployment_target = '11.0' | ||
s.dependency 'Capacitor' | ||
s.swift_version = '5.1' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Copyright 2020-present Ionic | ||
https://ionic.io | ||
|
||
MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
# @capacitor/geolocation | ||
|
||
The Geolocation API provides simple methods for getting and tracking the current position of the device using GPS, along with altitude, heading, and speed information if available. | ||
|
||
## Install | ||
|
||
```bash | ||
npm install @capacitor/geolocation | ||
npx cap sync | ||
``` | ||
|
||
## API | ||
|
||
<docgen-index> | ||
|
||
* [`getCurrentPosition(...)`](#getcurrentposition) | ||
* [`watchPosition(...)`](#watchposition) | ||
* [`clearWatch(...)`](#clearwatch) | ||
* [`checkPermissions()`](#checkpermissions) | ||
* [`requestPermissions()`](#requestpermissions) | ||
* [Interfaces](#interfaces) | ||
* [Type Aliases](#type-aliases) | ||
|
||
</docgen-index> | ||
|
||
<docgen-api> | ||
<!--Update the source file JSDoc comments and rerun docgen to update the docs below--> | ||
|
||
### getCurrentPosition(...) | ||
|
||
```typescript | ||
getCurrentPosition(options?: GeolocationOptions | undefined) => Promise<GeolocationPosition> | ||
``` | ||
|
||
Get the current GPS location of the device | ||
|
||
| Param | Type | | ||
| ------------- | ----------------------------------------------------------------- | | ||
| **`options`** | <code><a href="#geolocationoptions">GeolocationOptions</a></code> | | ||
|
||
**Returns:** <code>Promise<<a href="#geolocationposition">GeolocationPosition</a>></code> | ||
|
||
**Since:** 1.0.0 | ||
|
||
-------------------- | ||
|
||
|
||
### watchPosition(...) | ||
|
||
```typescript | ||
watchPosition(options: GeolocationOptions, callback: GeolocationWatchCallback) => CallbackID | ||
``` | ||
|
||
Set up a watch for location changes. Note that watching for location changes | ||
can consume a large amount of energy. Be smart about listening only when you need to. | ||
|
||
| Param | Type | | ||
| -------------- | ----------------------------------------------------------------------------- | | ||
| **`options`** | <code><a href="#geolocationoptions">GeolocationOptions</a></code> | | ||
| **`callback`** | <code><a href="#geolocationwatchcallback">GeolocationWatchCallback</a></code> | | ||
|
||
**Returns:** <code>string</code> | ||
|
||
**Since:** 1.0.0 | ||
|
||
-------------------- | ||
|
||
|
||
### clearWatch(...) | ||
|
||
```typescript | ||
clearWatch(options: { id: string; }) => Promise<void> | ||
``` | ||
|
||
Clear a given watch | ||
|
||
| Param | Type | | ||
| ------------- | ---------------------------- | | ||
| **`options`** | <code>{ id: string; }</code> | | ||
|
||
**Since:** 1.0.0 | ||
|
||
-------------------- | ||
|
||
|
||
### checkPermissions() | ||
|
||
```typescript | ||
checkPermissions() => Promise<GeolocationPermissionStatus> | ||
``` | ||
|
||
Check location permissions | ||
|
||
**Returns:** <code>Promise<<a href="#geolocationpermissionstatus">GeolocationPermissionStatus</a>></code> | ||
|
||
**Since:** 1.0.0 | ||
|
||
-------------------- | ||
|
||
|
||
### requestPermissions() | ||
|
||
```typescript | ||
requestPermissions() => Promise<GeolocationPermissionStatus> | ||
``` | ||
|
||
Request location permissions | ||
|
||
**Returns:** <code>Promise<<a href="#geolocationpermissionstatus">GeolocationPermissionStatus</a>></code> | ||
|
||
**Since:** 1.0.0 | ||
|
||
-------------------- | ||
|
||
|
||
### Interfaces | ||
|
||
|
||
#### GeolocationPosition | ||
|
||
| Prop | Type | Description | Since | | ||
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | ----- | | ||
| **`timestamp`** | <code>number</code> | Creation timestamp for coords | 1.0.0 | | ||
| **`coords`** | <code>{ latitude: number; longitude: number; accuracy: number; altitudeAccuracy: number \| null; altitude: number \| null; speed: number \| null; heading: number \| null; }</code> | The GPS coordinates along with the accuracy of the data | 1.0.0 | | ||
|
||
|
||
#### GeolocationOptions | ||
|
||
| Prop | Type | Description | Default | Since | | ||
| ------------------------ | -------------------- | ------------------------------------------------------------------------------------------ | ------------------ | ----- | | ||
| **`enableHighAccuracy`** | <code>boolean</code> | High accuracy mode (such as GPS, if available) | <code>false</code> | 1.0.0 | | ||
| **`timeout`** | <code>number</code> | The maximum wait time in milliseconds for location updates | <code>10000</code> | 1.0.0 | | ||
| **`maximumAge`** | <code>number</code> | The maximum age in milliseconds of a possible cached position that is acceptable to return | <code>0</code> | 1.0.0 | | ||
|
||
|
||
#### GeolocationPermissionStatus | ||
|
||
| Prop | Type | | ||
| -------------- | ------------------------------------------------------------- | | ||
| **`location`** | <code><a href="#geolocationstate">GeolocationState</a></code> | | ||
|
||
|
||
### Type Aliases | ||
|
||
|
||
#### GeolocationWatchCallback | ||
|
||
<code>(position: <a href="#geolocationposition">GeolocationPosition</a> | null, err?: any): void</code> | ||
|
||
|
||
#### CallbackID | ||
|
||
<code>string</code> | ||
|
||
|
||
#### GeolocationState | ||
|
||
<code><a href="#permissionstate">PermissionState</a></code> | ||
|
||
|
||
#### PermissionState | ||
|
||
<code>'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'</code> | ||
|
||
</docgen-api> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
ext { | ||
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.12' | ||
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.1' | ||
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.2.0' | ||
playServicesLocationVersion = project.hasProperty('playServicesLocationVersion') ? rootProject.ext.playServicesLocationVersion : '17.0.0' | ||
} | ||
|
||
buildscript { | ||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:4.1.1' | ||
} | ||
} | ||
|
||
apply plugin: 'com.android.library' | ||
|
||
android { | ||
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 29 | ||
defaultConfig { | ||
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21 | ||
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 29 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
lintOptions { | ||
abortOnError false | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
} | ||
|
||
repositories { | ||
google() | ||
jcenter() | ||
mavenCentral() | ||
} | ||
|
||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
implementation project(':capacitor-android') | ||
implementation "com.google.android.gms:play-services-location:$playServicesLocationVersion" | ||
testImplementation "junit:junit:$junitVersion" | ||
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion" | ||
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Project-wide Gradle settings. | ||
|
||
# IDE (e.g. Android Studio) users: | ||
# Gradle settings configured through the IDE *will override* | ||
# any settings specified in this file. | ||
|
||
# For more details on how to configure your build environment visit | ||
# http://www.gradle.org/docs/current/userguide/build_environment.html | ||
|
||
# Specifies the JVM arguments used for the daemon process. | ||
# The setting is particularly useful for tweaking memory settings. | ||
org.gradle.jvmargs=-Xmx1536m | ||
|
||
# When configured, Gradle will run in incubating parallel mode. | ||
# This option should only be used with decoupled projects. More details, visit | ||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | ||
# org.gradle.parallel=true | ||
|
||
# AndroidX package structure to make it clearer which packages are bundled with the | ||
# Android operating system, and which are packaged with your app's APK | ||
# https://developer.android.com/topic/libraries/support-library/androidx-rn | ||
android.useAndroidX=true | ||
# Automatically convert third-party libraries to use AndroidX | ||
android.enableJetifier=true |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.