nativescript-mapbox: Cannot read property 'getLocationServices' of undefined
Hi,
i’m trying to add a mapbox to my view (android). My view uses the RadSideDrawer from Telerik UI (actually I’m using nativescriptng2drawerseed) and implements OnInit.
I’ve used @nraboy’s demo app nativescript-photos-near-me to get into everything. Seemed to be pretty easy, however I’m experiencing some issues.
What i did:
app.module.ts
var map = require("nativescript-mapbox");
registerElement("Mapbox", () => map.Mapbox);
home.page.xml
<ContentView height="240" width="240">
<Mapbox
accessToken="MY_API_KEY"
height="240"
latitude="52.3702"
longitude="4.8951"
zoomLevel="3"
mapStyle="light"
showUserLocation="true"
hideCompass="false"
(mapReady)="onMapReady($event)">
</Mapbox>
</ContentView>
home.page.ts
...
public onMapReady(args) {
this.mapbox = args.map;
}
...
AndroidManifest.xml First issue: my app doesn’t start, if I add
<service android:name="com.mapbox.mapboxsdk.telemetry.TelemetryService" />
in AndroidManifest.xml. Instead, i have to use
<service android:name="com.mapbox.services.android.telemetry.service.TelemetryService" />
After adding the “right” service, the map shows on my view (without location marker) but as soon as the location permissions are granted, I’m getting following TypeError:
JS: Unhandled Promise rejection: Cannot read property 'getLocationServices' of undefined ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Cannot read property 'getLocationServices' of undefined TypeError: Cannot read property 'getLocationServices' of undefined
JS: at Object.mapbox._showLocation (file:///data/data/org.nativescript.nativescriptng2drawerseed/files/app/tns_modules/nativescript-mapbox/mapbox.js:189:75)
JS: at file:///data/data/org.nativescript.nativescriptng2drawerseed/files/app/tns_modules/nativescript-mapbox/mapbox.js:57:28
JS: at ZoneDelegate.invoke (file:///data/data/org.nativescript.nativescriptng2drawerseed/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:190:28)
JS: at Zone.run (file:///data/data/org.nativescript.nativescriptng2drawerseed/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:83:43)
JS: at file:///data/data/org.nativescript.nativescriptng2drawerseed/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:449:57
JS: at ZoneDelegate.invokeTask (file:///data/data/org.nativescript.nativescriptng2drawerseed/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:223:37)
JS: at Zone.runTask (file:///data/data/org.nativescript.nativescriptng2drawerseed/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:123:47)
JS: at drainMicroTaskQueue (file:///data/data/org.nativescript.nativescriptng2drawerseed/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:355:35)
JS: Error: Uncaught (in promise): TypeError: Cannot read property 'getLocationServices' of undefined
Did i miss something?
Thank you in advance!
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 15
Commits related to this issue
- #80 Cannot read property 'getLocationServices' of undefined — committed to Yermo/nativescript-mapbox by deleted user 7 years ago
- #80 Cannot read property 'getLocationServices' of undefined — committed to Yermo/nativescript-mapbox by deleted user 7 years ago
- #80 Cannot read property 'getLocationServices' of undefined - And yet another method was removed in the Android Mapbox SDK :( — committed to Yermo/nativescript-mapbox by deleted user 7 years ago
- #80 Cannot read property 'getLocationServices' of undefined — committed to Yermo/nativescript-mapbox by EddyVerbruggen 7 years ago
- #80 Cannot read property 'getLocationServices' of undefined — committed to Yermo/nativescript-mapbox by EddyVerbruggen 7 years ago
- #80 Cannot read property 'getLocationServices' of undefined - And yet another method was removed in the Android Mapbox SDK :( — committed to Yermo/nativescript-mapbox by EddyVerbruggen 7 years ago
Works great !
Thanks @EddyVerbruggen