Location not working on P40 pro

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

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

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 ?

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.

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

Web app is here…
https://thunkable.site/w/fddhul_Ui

Project here
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?

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

1 Like