I have an Ionic 3.7.0 project. As I needed to implement a GPS feature, I installed cordova-plugin-geoloaction
and @ionic-native/geolocation
. I added it as on of my providers and included it to the page where I needed it.
geo-page.ts
if (this.platform.is('cordova')) {
this.gps.getCurrentPosition().then(data => {
this.location.lat = data.coords.latitude;
this.location.lng = data.coords.longitude;
console.log('[DEBUG] Location: ' + JSON.stringify(this.location));
}, error => {
console.log('[DEBUG] Promise Rejected. ' + JSON.stringify(error));
}).catch(error => {
console.log('[DEBUG] Promise Unfulfilled. ' + JSON.stringify(error));
});
[...]
}
This is what was output in the LogCat
:
08-05 18:44:04.807 I/chromium(11230): [INFO:CONSOLE(121)] "[DEBUG] Promise Unfulfilled. {"__zone_symbol__currentTask":{"type":"microTask","state":"notScheduled","source":"Promise.then","zone":"angular","cancelFn":null,"runCount":0}}", source: file:///android_asset/www/build/1.js (121)
Here’s the expanded JSON for ease…
{
"__zone_symbol__currentTask":
{
"type":"microTask",
"state":"notScheduled",
"source":"Promise.then",
"zone":"angular",
"cancelFn":null,
"runCount":0
}
}
Ionic info
$ ionic info
cli packages: (C:\ionic\node_modules)
@ionic/cli-plugin-cordova : 1.6.2
@ionic/cli-plugin-ionic-angular : 1.4.1
@ionic/cli-utils : 1.7.0
ionic (Ionic CLI) : 3.7.0
global packages:
Cordova CLI : 7.0.1
local packages:
@ionic/app-scripts : 2.1.3
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 3.4.0
System:
Android SDK Tools : 26.0.1
Node : v6.11.2
OS : Windows 10
npm : 3.10.10
I have absolutely no idea what’s going on. I followed the instructions and it just doesn’t seem to be working.