question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

enableLocationRequest promise never gets resolved on Android

See original GitHub issue

Which platform(s) does your issue occur on?

  • Android 7.1 Emulator

Please, provide the following version numbers that your issue occurs with:

  • CLI: 3.3.0
  • Cross-platform modules: 3.2.0
  • Runtime(s): 3.2.0
  • Plugin(s):
    "nativescript-drop-down": "3.1.1",
    "nativescript-geolocation": "4.2.0",
    "nativescript-google-maps-sdk": "2.3.2",
    "nativescript-ios-uuid": "1.0.0",
    "nativescript-iqkeyboardmanager": "1.0.1",
    "nativescript-local-notifications": "1.2.2",
    "nativescript-phone": "1.3.0",
    "nativescript-push-notifications": "0.1.5",
    "nativescript-theme-core": "1.0.4",
    "tns-core-modules": "3.2.0"

Please, tell us how to recreate the issue in as much detail as possible.

Well, simply request location permission on Android device.

Is there any code involved?

      geolocation.enableLocationRequest().then( function () {
         // I never get here...
      });

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ickatacommented, Nov 5, 2017

@DimitarTachev : geolocation.getCurrentLocation({ timeout : 0 }) works.

0reactions
karthiksbhatcommented, May 16, 2018

@DimitarTachev In your comment you mentioned using Accuracy.any could cause this behavior on devices without a mobile network? Is there a reliable way to get (at least) a coarse location on devices without network (or on airplane mode)?

I’ve been having the same issue on my app, seemingly randomly, for a while now. i.e.

geolocation.getCurrentLocation({desiredAccuracy: Accuracy.any, timeout: 10000}).then( function ( loc ) {
      // I never get here...
   }, function ( err ) {
      // and neither here...
   });

Is the way to fix it timeout: 0 or removing the timeout altogether?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Geolocation: right way to use getCurrentLocation promise ...
resolve () // Start promise chain with a resolved native Promise. .then(function() { if (!Geolocation.isEnabled()) { return Geolocation.
Read more >
Promise.resolve() - JavaScript - MDN Web Docs
The Promise.resolve() method "resolves" a given value to a Promise. ... eventual fulfillment value of the promise will never be thenable.
Read more >
Track The Device Geolocation In A NativeScript Angular ...
Learn how to use native geolocation features within a NativeScript Android and iOS application built with Angular to track device location.
Read more >
JavaScript Promises: an introduction - web.dev
The promise constructor takes one argument, a callback with two parameters, resolve and reject. Do something within the callback, perhaps async, ...
Read more >
Async and Await in JavaScript, the extension to a promise.
Here is an example with a promise that resolves in 2 seconds. This is a more elegant way of getting a promise result...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found