Location not working on P40 pro


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 ?


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


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 ?


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
with labelLat set text to latitude
with labelLong set text to longitude

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

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.


Web app is here…

Project here

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?

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:


1 Like