# Location not working on P40 pro

**URL:** <https://community.thunkable.com/t/location-not-working-on-p40-pro/1032049>\
**Category:** Questions about Thunkable X\
**Created:** [December 10, 2020, 2:10pm UTC](https://community.thunkable.com/t/location-not-working-on-p40-pro/1032049 "2020-12-10T14:10:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulbthatsme](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@paulbthatsme](https://community.thunkable.com/u/paulbthatsme)\
**Post date:** [December 10, 2020, 2:10pm UTC](https://community.thunkable.com/t/location-not-working-on-p40-pro/1032049/1 "2020-12-10T14:10:12Z")

</div>

Hi,

I have a Huawei P40 pro and for some reason the location sensor does not work.

It just returns 0 and 0 for lat and long.

If I create a web app and access that from the phone, the location is returned correctly but if i install the app directly on the phone via an apk file then I just get 0 and 0.

Location services are turned on. If I turn them off then it returns null and null (as I would expect).

Also tested on a Samsung S8 and that works correctly.

I realise the P40 pro cannot use google play services and therefore google maps don’t work but I would have thought the gps sensor would work.

Any ideas ?

Thanks

---

<div class="post-metadata">

**Author:** ![eko.devs.apploroceo](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eko.devs.apploroceo/32/93147_2.png) [@eko.devs.apploroceo](https://community.thunkable.com/u/eko.devs.apploroceo)\
**Post date:** [December 11, 2020, 3:57am UTC](https://community.thunkable.com/t/location-not-working-on-p40-pro/1032049/2 "2020-12-11T03:57:39Z")

</div>

show ur blocks.  
or  
maybe the sensor isnt supporting the phone.

---

<div class="post-metadata">

**Author:** ![kushweez](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/kushweez/32/90265_2.png) [@kushweez](https://community.thunkable.com/u/kushweez)\
**Post date:** [December 11, 2020, 9:14am UTC](https://community.thunkable.com/t/location-not-working-on-p40-pro/1032049/3 "2020-12-11T09:14:14Z")

</div>

Hi,

It seems to me that on thunkable live it returns 0 in position, did you try to download the Android application, install it and test it ?

---

<div class="post-metadata">

**Author:** ![Michael\_Rogulla](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@Michael\_Rogulla](https://community.thunkable.com/u/Michael_Rogulla)\
**Post date:** [December 11, 2020, 12:36pm UTC](https://community.thunkable.com/t/location-not-working-on-p40-pro/1032049/4 "2020-12-11T12:36:58Z")

</div>

Hi,

I haven’t seen you blocks, but I would like to look here:

- did you evaluate the green “error” - block in the “get position”? It can give valuable hints.
- did you convert latitude and longitude explicitely to numbers? Maybe the block gives a string.

The blocks can look like this:  
if not error  
with labelDebug set text to error  
else  
with labelLat set text to latitude  
with labelLong set text to longitude  
endif

If you want to use Map.setMarker use an explicit conversion like setMarker.latitude = (0 + Latitude) etc.

---

<div class="post-metadata">

**Author:** ![paulbthatsme](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@paulbthatsme](https://community.thunkable.com/u/paulbthatsme)\
**Post date:** [December 11, 2020, 1:41pm UTC](https://community.thunkable.com/t/location-not-working-on-p40-pro/1032049/5 "2020-12-11T13:41:32Z")

</div>

I have created a very simple test project…

All it does is get the latitude and longitude then displays it in 2 labels, with a 3rd label displaying any error.

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/1/e113b0015053863dcb1e44aaf9304d1b0617665c.png)

Web app is here…  
[https://thunkable.site/w/fddhul\_Ui](https://thunkable.site/w/fddhul_Ui)

Project here  
[https://x.thunkable.com/projectPage/5fd373994fc0660011231847](https://x.thunkable.com/projectPage/5fd373994fc0660011231847)

The web app works on my laptop (allowing location sharing) and on my P40 phone.

But when I download the apk file to the P40, the labels do not update. When I first load the app it asks about allowing location and I answer yes to that.

And if I download the apk file to my samsung s8 then it works fine.

I can only assume it has something to do with the P40 phone but other apps (not thunkable apps) that require location are working fine.

Does anyone else own a Huawei P40 phone that could try testing a thunkable app with a location sensor?

---

<div class="post-metadata">

**Author:** ![Michael\_Rogulla](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@Michael\_Rogulla](https://community.thunkable.com/u/Michael_Rogulla)\
**Post date:** [December 14, 2020, 8:54pm UTC](https://community.thunkable.com/t/location-not-working-on-p40-pro/1032049/6 "2020-12-14T20:54:38Z")

</div>

Order of the blocks is important. Always check “error” first!

If there is an error, which prevents you from using the latitude, the block with “lblerror set Text to error” never gets executed.

I suggest:

![grafik](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/6/86e624eff4dceaab90ecc0f0060f55d15633e522.png)

---

<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, 12:19pm UTC](https://community.thunkable.com/t/location-not-working-on-p40-pro/1032049/7 "2024-11-08T12:19:44Z")

</div>


