Strange Thing About Location Sensor in Hong Kong

I've got a strange thing about LocationSensor in Hong Kong.

Sometimes, even when I enabled the location sensor and allowed the permission to track my location, the latitude and the longitude all returns 0 in Hong Kong. It will take a few minutes (5 ~ 10) if I want to change that number back to normal. I know that when LocationSensor returns 0, it means that no co-ordinates are available, I just want to know why.

The code is the same.

when Screen1.Intialize, set LatitudeLabel.Text to LocationSensor1.Latitude, set LongitudeLabel.Text to LocationSensor1.Longitude
when LocationSensor1.LocationChanged, set LatitudeLabel.Text to get latitude, set LongitudeLabel.Text to get longitude.

The same thing applies to LocationSensor1.CurrentAddress, when it returns No address available. It also happens in Kodular. I'm wondering if there is a bug in the system.

Thanks.

1 Like

I'm wondering if it's because of China's extreme censorship policy; yet, again, you are in Hong Kong, so that's likely not the case.

Have you been able to successfully implement the LocationSensor in the past?

Google is accessible in parts of China, i.e., Taiwan, Hong Kong, Macau, small parts of Shanghai, so the problem is definitely not about Google or others blocked.

I was able to do that only sometimes.

1 Like

Hi Gordon.

Show an image of all your Blocks to get help.

There could be several issues:

  • your Blocks might not be optimal. Have you tried the two aia's that are part of Using the Location Sensor ? Do you get the same results?

The tutorial probably answers your question. The initial satellite fix might take 30 to 60 seconds or more to produce coordinates. Hong Kong is a canyon of buildings. The buildings may Block line-of-sight between the required satellites and your Android at some locations within the highly populated city/region. To elicit an LocationChanged event, the gps receiver needs to 'see' at least three satellites. Depending on where you are at, that might take a while. Are you testing in an apartment? Then go outside, perhaps to a city park, you might have a better result.

Why No adddress available displays instead of a street address is discussed in this tutorial HOW TO: Parse a LocationSensor's Current Address by SteveJG . Simply. a user may receive that message if no address can be resolved using the current gps coordinates in Google's database. The CurrentAddress must be in Google's database. If the database does not have an 'address' associated with the current coordinates you get the default message.

The message appears to users when they are in the middle of farm land where there are no addresses; in large cities for some locations where addresses are ill defined and if Google is Blocked from receiving that information and for other reasons.

3 Likes

It may also depend on where you are in Hong Kong. Tall buildings can often block GPS reception, so if you're at street level in HK proper versus Lantau you will get different experiences.

1 Like

I'm on a tall building and there is nothing blocking here. My phone is facing towards the ocean.

Here is the Blocks:

image

Yes, I am testing in apartment. I'll try it!

It is in Google's database, because sometimes it does return my address.

Probably this explains, I'll try.

1 Like

Add this Block in Screen1.Initialize as the first Block
timeInterval

The Block will attempt to refresh your Location every 30 seconds rather than the default TimeInterval of a minute (60000 ms).

Does using the Block help?

3 Likes

It worked! Thank you!

1 Like

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