Cannot read property 'getLocationServices' of undefined
See original GitHub issueHi,
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!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:15
Top Results From Across the Web
Cannot read property 'getLocationServices' of undefined #80
Hi, i'm trying to add a mapbox to my view (android). My view uses the RadSideDrawer from Telerik UI (actually I'm using ...
Read more >Angular 8: ERROR TypeError: Cannot read property ...
Try to put initial value for lat:any; long:any; url:any; weatherUrl:any; , It seems that the urls are undefined when using them. – Fateme...
Read more >[SSL Pinning Plugin] Error - Cannot read property 'apply' for ...
With original Multilingual, the application crashed and in logs it gave error: [ErrorScreen] Cannot read property 'apply' of undefined. With cloned Multilingual ...
Read more >How to Avoid Getting 'Cannot read property of undefined' in ...
Learn how you can avoid getting the famous 'Cannot read property of undefined' error in JavaScript with the logical OR operator.
Read more >Cannot read property 'toLowerCase' of undefined-angular.js
Coding example for the question Angular 8: ERROR TypeError: Cannot read property 'toLowerCase' of undefined-angular.js.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Works great !
Thanks @EddyVerbruggen
It’s on npm.