# Location Sensor Unable to retrieve location with cellular data

**URL:** <https://community.thunkable.com/t/location-sensor-unable-to-retrieve-location-with-cellular-data/1482946>\
**Category:** Questions about Thunkable X\
**Tags:** locationsensor\
**Created:** [September 2, 2021, 6:49am UTC](https://community.thunkable.com/t/location-sensor-unable-to-retrieve-location-with-cellular-data/1482946 "2021-09-02T06:49:26Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [September 24, 2021, 5:35pm UTC](https://community.thunkable.com/t/location-sensor-unable-to-retrieve-location-with-cellular-data/1482946/21 "2021-09-24T17:35:21Z")

</div>

Thanks @tatiang

@aikansh.dua044gefzj  
See this project on old platform  
[https://x.thunkable.com/projectPage/614e0a44b5d2730010889902](https://x.thunkable.com/projectPage/614e0a44b5d2730010889902)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 24, 2021, 5:39pm UTC](https://community.thunkable.com/t/location-sensor-unable-to-retrieve-location-with-cellular-data/1482946/22 "2021-09-24T17:39:08Z")

</div>

You’re welcome.

Both of your demos (DnD and StP) work beautifully on my iPhone 11 with no errors.

---

<div class="post-metadata">

**Author:** ![aikansh.dua044gefzj](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@aikansh.dua044gefzj](https://community.thunkable.com/u/aikansh.dua044gefzj)\
**Post date:** [September 24, 2021, 5:41pm UTC](https://community.thunkable.com/t/location-sensor-unable-to-retrieve-location-with-cellular-data/1482946/23 "2021-09-24T17:41:08Z")

</div>

Will test via apk and update

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [September 24, 2021, 5:42pm UTC](https://community.thunkable.com/t/location-sensor-unable-to-retrieve-location-with-cellular-data/1482946/24 "2021-09-24T17:42:23Z")

</div>

The only error that I would expect is when starting the app and `Location Services` is not active on the phone. There could be an error the first time as it will timeout before the `Location Services` starts on the phone.

---

<div class="post-metadata">

**Author:** ![aikansh.dua044gefzj](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@aikansh.dua044gefzj](https://community.thunkable.com/u/aikansh.dua044gefzj)\
**Post date:** [September 24, 2021, 5:58pm UTC](https://community.thunkable.com/t/location-sensor-unable-to-retrieve-location-with-cellular-data/1482946/25 "2021-09-24T17:58:40Z")

</div>

I tried it on the apk it is completely random as you can see in the video attached below however I just want to retrieve the coordinates once and use an api so just like you did you applied an loop maybe I was thinking that there could be a loop that calls location till there is an error and once it has got the location it can just exit the loop and do the api conmand  
[https://drive.google.com/file/d/1AyYzP27XRZEe3ncCBl5p7o43vWdzVoHe/view?usp=sharing](https://drive.google.com/file/d/1AyYzP27XRZEe3ncCBl5p7o43vWdzVoHe/view?usp=sharing)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [September 24, 2021, 6:01pm UTC](https://community.thunkable.com/t/location-sensor-unable-to-retrieve-location-with-cellular-data/1482946/26 "2021-09-24T18:01:13Z")

</div>

Of course you can exit the loop any time. I am using a timer here. All what you need to do is to check the `green error` block. If **no errors** then read the coordinates and stop the timer.

**[Edit]**  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/6/16577b6bdf6be598d2427245f268cdfe37194611.png)

One thing to note is the `Maximum Age`. It will wait for 1000 millisecond before it reports an error. When using cellular data you might need to consider giving a little more time and I am setting the timer to `fire` every second, you might want to make it wait a little longer.

---

<div class="post-metadata">

**Author:** ![aikansh.dua044gefzj](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@aikansh.dua044gefzj](https://community.thunkable.com/u/aikansh.dua044gefzj)\
**Post date:** [September 24, 2021, 6:12pm UTC](https://community.thunkable.com/t/location-sensor-unable-to-retrieve-location-with-cellular-data/1482946/27 "2021-09-24T18:12:26Z")

</div>

Set the timer to 2 seconds and age to 2000 and changed the blocks  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/5/f5ed27dd55bcb6e473d7a34d1502e4fce9457e49.png)  
And now it works perfectly @muneer Thanks!

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [September 24, 2021, 6:14pm UTC](https://community.thunkable.com/t/location-sensor-unable-to-retrieve-location-with-cellular-data/1482946/28 "2021-09-24T18:14:02Z")

</div>

You’re welcome

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 27, 2021, 8:45am UTC](https://community.thunkable.com/t/location-sensor-unable-to-retrieve-location-with-cellular-data/1482946/29 "2021-09-27T08:45:40Z")

</div>

I’m finally getting around to testing this on my Android device and it gives me the “location provider is unavailable” error message 2/3 of the time it fires. The remaining 1/3 of the time it fires, it displays the lat/lon info.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [September 27, 2021, 10:11am UTC](https://community.thunkable.com/t/location-sensor-unable-to-retrieve-location-with-cellular-data/1482946/30 "2021-09-27T10:11:55Z")

</div>

Just increase the `Maximum Age` in the `Location Sensor` to 2000 and adjust the timer to fire every 2 seconds. Some Android devices needs a bit more time to provide the results.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 27, 2021, 2:49pm UTC](https://community.thunkable.com/t/location-sensor-unable-to-retrieve-location-with-cellular-data/1482946/31 "2021-09-27T14:49:59Z")

</div>

I’ll try increasing the timer interval. But `Maximum Age` refers to the oldest GPS data that the sensor will return without querying new location data. It doesn’t have anything to do with sensor timeouts.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 27, 2021, 2:52pm UTC](https://community.thunkable.com/t/location-sensor-unable-to-retrieve-location-with-cellular-data/1482946/32 "2021-09-27T14:52:12Z")

</div>

I also tried using a location sensor in an app I’m building and I see a similar problem on Android: if I manually check the location, it works about 1/3 of the time. I don’t have a timer in that app. Maybe I need to increase the `Timeout` value. I have it set to 10000.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 1:16pm UTC](https://community.thunkable.com/t/location-sensor-unable-to-retrieve-location-with-cellular-data/1482946/33 "2024-11-08T13:16:59Z")

</div>

Closed on November 8, 2024, 1:16pm UTC



[Previous page](https://community.thunkable.com/t/location-sensor-unable-to-retrieve-location-with-cellular-data/1482946.md?page=1)
