Closed amobarak closed 5 years ago
Works fine on iOS but not android, this is happening after I updated to latest version of nativescript 6.
Nativescript-geolocation version: 5.1.0 Nativescript CLI: 6
android { project.ext { googlePlayServicesVersion = "15.0.1" } }
project.ext { googlePlayServicesVersion = "+" }
JS: ERROR Error: Uncaught (in promise): Error: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference JS: android.app.Dialog.(Dialog.java:171) JS: android.app.Dialog.(Dialog.java:155) JS: cn.refactor.lib.colordialog.PromptDialog.(PromptDialog.java:56) JS: cn.refactor.lib.colordialog.PromptDialog.(PromptDialog.java:52) JS: com.tns.Runtime.callJSMethodNative(Native Method) JS: com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1242) JS: com.tns.Runtime.callJSMethodImpl(Runtime.java:1122) JS: com.tns.Runtime.callJSMethod(Runtime.java:1109) JS: com.tns.Runtime.callJSMethod(Runtime.java:1089) JS: com.tns.Runtime.callJSMethod(Runtime.java:1081) JS: com.tns.gen.com.google.android.gms.location.LocationCallback_vendor_9106477.onLocationResult(LocationCallback_vendor_9106477.java:19) JS: com.google.android.gms.internal.location.zzau.notifyListener(Unknown Source) JS: com.google...
geolocation.enableLocationRequest().then(() => { geolocation.getCurrentLocation({ desiredAccuracy: 3, maximumAge: 5000, timeout: 20000, minimumUpdateTime: 10 }).then( (location) => { this.locationChanged.next(location); }, () => { this.locationChanged.error(null) } ) }, () => { this.alert.showError("Error setting location, please enable GPS", "Got it"); } )
Works fine on iOS but not android, this is happening after I updated to latest version of nativescript 6.
Nativescript-geolocation version: 5.1.0 Nativescript CLI: 6
I added this to the app.gradle:
android {
project.ext { googlePlayServicesVersion = "15.0.1" } }
and this to the before-plugins.gradle:
project.ext { googlePlayServicesVersion = "+" }
I get the following error:
JS: ERROR Error: Uncaught (in promise): Error: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference JS: android.app.Dialog.(Dialog.java:171)
JS: android.app.Dialog.(Dialog.java:155)
JS: cn.refactor.lib.colordialog.PromptDialog.(PromptDialog.java:56)
JS: cn.refactor.lib.colordialog.PromptDialog.(PromptDialog.java:52)
JS: com.tns.Runtime.callJSMethodNative(Native Method)
JS: com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1242)
JS: com.tns.Runtime.callJSMethodImpl(Runtime.java:1122)
JS: com.tns.Runtime.callJSMethod(Runtime.java:1109)
JS: com.tns.Runtime.callJSMethod(Runtime.java:1089)
JS: com.tns.Runtime.callJSMethod(Runtime.java:1081)
JS: com.tns.gen.com.google.android.gms.location.LocationCallback_vendor_9106477.onLocationResult(LocationCallback_vendor_9106477.java:19)
JS: com.google.android.gms.internal.location.zzau.notifyListener(Unknown Source)
JS: com.google...
The code I'm using: