getHeadingAsync() sometime is not executed

Hi, i have problem with getHeadingAsync() some time fire an error subscription.remove() is undefined in Location.js 80. I try to add this code checking if subscription is defined

subscription = await watchHeadingAsync((heading) => {
if (!done) {
if (heading.accuracy > 1 || tries > 5) {
subscription && subscription.remove();
resolve(heading);
done = true;
}
else {
tries += 1;
}
}
else {
subscription && subscription.remove();
}
});
if (done) {
subscription && subscription.remove();
}
But sometime the function does not being executed. How can be fixed?

Hey @lgngr,

Can you create a reproducible example of this for us to test? Ideally in the form of a Snack.

Cheers,
Adam

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.