You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/12/16 14:03:47 UTC
[GitHub] [cordova-plugin-geolocation] carstenbaumhoegger opened a new issue
#184: Plugin doesn't work when wrapped inside a service on iOS
carstenbaumhoegger opened a new issue #184: Plugin doesn't work when wrapped inside a service on iOS
URL: https://github.com/apache/cordova-plugin-geolocation/issues/184
# Bug Report
## Problem
We use Ionic 4 with Angular for our application.
When I wrap the plugins functionality inside a service, everything works fine on Android. On iOS though, no location can be obtained.
When I copy the methods from the used service 1:1 into the component that uses the service, everything works as expected on Android and iOS.
### What is expected to happen?
Geolocation can be obtained through a centralized service inside the application
### What does actually happen?
On iOS, no location usage permission request is fired. The only thing that is returned from the plugin is `code: 2`.
## Information
<!-- Include all relevant information that might help understand and reproduce the problem -->
### Command or Code
<!-- What command or code is needed to reproduce the problem? -->
I wrapped the `watchPosition` method inside of a simple Angular service. Basically it executes the following method:
```js
private startPositionWatching () {
if (this.positionWatchSubscription == null) {
this.positionWatchSubscription = this.geolocation.watchPosition({ enableHighAccuracy: true, maximumAge: 15000 }).subscribe(async (position: any) => {
// do something with position
}, (error) => {
console.error('watch position error', error);
});
}
}
```
### Environment, Platform, Device
<!-- In what environment, on what platform or on which device are you experiencing the issue? -->
iOS 12 / 13 (didn't test older versions).
Can be reproduced on physical device and in the simulator.
### Version information
<!--
What are relevant versions you are using?
For example:
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
Other Frameworks: Ionic Framework and CLI version
Operating System, Android Studio, Xcode etc.
-->
```
Ionic:
Ionic CLI : 5.4.12 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.11.5
@angular-devkit/build-angular : 0.803.20
@angular-devkit/schematics : 8.3.20
@angular/cli : 8.3.20
@ionic/angular-toolkit : 2.1.1
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.0.0, ios 5.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 16 other plugins)
Utility:
cordova-res (update available: 0.8.1) : 0.6.0
native-run (update available: 0.3.0) : 0.2.2
System:
ios-deploy : 1.9.4
ios-sim : 8.0.2
NodeJS : v12.13.1 (/usr/local/bin/node)
npm : 6.12.1
OS : macOS Catalina
Xcode : Xcode 11.2.1 Build version 11B53
```
```
cordova-plugin-geolocation 4.0.2 "Geolocation"
```
## Checklist
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org