Can't get correct location information before use other GPS apps

Bug #1481240 reported by Shawn Wang
46
This bug affects 8 people
Affects Status Importance Assigned to Milestone
NearBy Scope
New
Undecided
Unassigned
location-service (Ubuntu)
Confirmed
Undecided
Unassigned
unity-scopes-api (Ubuntu)
Invalid
Undecided
Unassigned
unity-scopes-shell (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

My location should be Tainan, Taiwan.
If I did not run another GPS apps before, NearBy shows my location is in the center of Taiwan.

system-image-cli -i
current build number: 76
device name: arale
channel: ubuntu-touch/rc-proposed/meizu.en
last update: 2015-08-04 15:20:42
version version: 76
version ubuntu: 20150804
version device: 20150709-8965e37
version custom: 20150716-819-8-42

Revision history for this message
Kyle Nitzsche (knitzsche) wrote :

Hi Shawn,

I think the issue may be that when scopes first run, the location may not yet be known through GPS, and so the less accurate location from IP address based geo-location is used. After refreshing a scope, the GPS based more accurate location is known.

Can you please confirm this as follows:
1) reboot
2) go directly and immediately to the NearBy scope
3) report here whether the listed location is the accurate one or the inaacurate one.
4) refresh NearBy scope by pulling down
4) report here the listed location.

We need to determine whether the initial inaccurate location is due to the time it takes to get a GPS location or if it is due to a shell bug.

Revision history for this message
Shawn Wang (shawn111) wrote :

Hi Kyle,

I follow the steps:

1) reboot
2) go directly and immediately to the NearBy scope
3) report here whether the listed location is the accurate one or the inaacurate one.
>>> inaacurate one. (the center of Taiwan.)

4) refresh NearBy scope by pulling down
5) report here the listed location.
>>> accurate one. (Tainan, Taiwan.)

BTW, I can't find any related GPS config items in System Setting.
As I remember when I try to run other GPS apps, there is a GPS access config UI come out.
Not sure, it is related with this issue.

Revision history for this message
Shawn Wang (shawn111) wrote :

If this issue is happened due to the time to get GPS information.

Maybe store the latest location can be a solution.
If users change location, they need to refresh NearBy.

Revision history for this message
Kyle Nitzsche (knitzsche) wrote :

I have added unity-scopes-api since I don't think this has anything to do with the NearBy scope implementation.

Revision history for this message
Michi Henning (michihenning) wrote :

Pete, wasn't there some issue with location services being slow and falling back to IP location, which then gets cached for a while?

Revision history for this message
Pete Woods (pete-woods) wrote :

The scopes shell plugin does cache the GeoIP location, yes. It also has a timeout, and is refreshed periodically.

As soon as your device acquires a proper GPS lock, however, the scopes shell plugin immediately prefers the true GPS lock.

However, the location service does not provide any high level location information (country, region, city), only numerical information(latitude, longitude, altitude), so GeoIP is the only way we can it. This means that if a scope asks for your city, it can only be as accurate as your GeoIP information.

Really I'd like to see the location service providing high level location information, too. But last time I raised this, the idea was resisted.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in unity-scopes-api (Ubuntu):
status: New → Confirmed
Revision history for this message
Kyle Nitzsche (knitzsche) wrote :
Download full text (4.0 KiB)

If I have a proper precise (GPS based) location (lat&long) in a scope from SearchMetadata.location().latitude()|longitude(), and then disable Location indicator > Location detection OR GPS, then reenable it and refresh the scope, I never get a precise location back. I am stuck with geo IP derived location.

To demo this, I wrote a simple scope that merely gets the lat and long and logs it, or a message if ! has_location().

Here's the relevant code:

void Query::run(us::SearchReplyProxy const& reply)
{
    if (!metadata_.has_location())
    {
        qDebug() << "LOCTEST: no location: " + QDateTime::currentDateTime().toString();
        return;
    }
    try{
        auto lat = metadata_.location().latitude();
        auto lng = metadata_.location().longitude();
        qDebug() << "LOCTEST: lat long: " + QString::number(lat) + " " + QString::number(lng) + " " + QDateTime::currentDateTime().toString();
    } catch(unity::scopes::NotFoundException &e) {
        qWarning() << "==== Warning: Could not get location.";
    }
}

Query::Query(const us::CannedQuery &query, const us::SearchMetadata & metadata, const QVariant accessToken, QString const& cacheDir_) :
    SearchQueryBase(query, metadata),
    metadata_(metadata),
    cannedQuery(query),
    query_(query.query_string()),
    accessToken_(accessToken),
    cacheDir_(cacheDir_)
{

}

Here are the results from scope-registry log grepped with LOCTEST. COMMENTs and ACTIONs added:

COMMENT: starting lat/long are precise (GPS)

"LOCTEST: lat long: 42.4062 -71.6038 Mon Nov 30 23:32:46 2015"
"LOCTEST: lat long: 42.4062 -71.6038 Mon Nov 30 23:32:48 2015"

ACTION: disable indicator Location > Location detection

"LOCTEST: lat long: 42.4062 -71.6038 Mon Nov 30 23:33:24 2015"
"LOCTEST: lat long: 42.4062 -71.6038 Mon Nov 30 23:33:34 2015"
"LOCTEST: lat long: 42.4062 -71.6038 Mon Nov 30 23:33:36 2015"
"LOCTEST: lat long: 42.4062 -71.6038 Mon Nov 30 23:33:37 2015"

COMMENT: Why am I still seeing a precise location? Normally for me geo IP based location is the next town over.

ACTION restart unity8-dash

"LOCTEST: lat long: 42.5244 -71.7657 Mon Nov 30 23:33:59 2015"

COMMENT: That ^ is the geo IP based vague location, as expected.

"LOCTEST: no location: Mon Nov 30 23:34:07 2015"

COMMENT: why do I get no location?

"LOCTEST: lat long: 42.5244 -71.7657 Mon Nov 30 23:34:24 2015"

ACTION: indicator Location > Location detection enabled

"LOCTEST: lat long: 42.5244 -71.7657 Mon Nov 30 23:35:58 2015"
"LOCTEST: lat long: 42.5244 -71.7657 Mon Nov 30 23:36:03 2015"
"LOCTEST: lat long: 42.5244 -71.7657 Mon Nov 30 23:36:10 2015"
"LOCTEST: lat long: 42.5244 -71.7657 Mon Nov 30 23:36:13 2015"
"LOCTEST: lat long: 42.5244 -71.7657 Mon Nov 30 23:36:16 2015"
"LOCTEST: lat long: 42.5244 -71.7657 Mon Nov 30 23:36:54 2015"
"LOCTEST: lat long: 42.5244 -71.7657 Mon Nov 30 23:36:56 2015"
"LOCTEST: lat long: 42.5244 -71.7657 Mon Nov 30 23:37:02 2015"
"LOCTEST: lat long: 42.5244 -71.7657 Mon Nov 30 23:37:04 2015"
"LOCTEST: lat long: 42.5244 -71.7657 Mon Nov 30 23:37:11 2015"
"LOCTEST: lat long: 42.5244 -71.7657 Mon Nov 30 23:37:15 2015"

COMMENT: Several minutes have passed. Why do I still see vague geo IP based l...

Read more...

Revision history for this message
Michi Henning (michihenning) wrote :

Scopes-api is innocent here. I just passes the location info it gets from the shell without touching or caching it. Adding the shell and location-service to the bug.

Changed in unity-scopes-api (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Thomas Voß (thomas-voss) wrote :

I'm not convinced that location-service is causing issues here. We do not switch on positioning unless someone explicitly asks us to do so. In that case, it will take ~30 seconds until network-based positioning kicks in and likely another 2 - 3 minutes until the GPS hands us a position. With that, we are likely seeing a race on startup here.

For Pete's statement: The location service deals in numeric values on purpose. Geocoding and reverse geocoding is consciously left out and we assume other layers of the system to do a better job of the encoding/decoding task (we also want to avoid calling "home" to a geoip service from a central system service).

Revision history for this message
Kyle Nitzsche (knitzsche) wrote :

this branch contains an armhf click of a scope that shows the location passed (mentioned in comment #8) through Searchmetat obj as both a single scope result and into scope-registry.log:

lp:~knitzsche/savilerow/location_tester

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in location-service (Ubuntu):
status: New → Confirmed
Changed in unity-scopes-shell (Ubuntu):
status: New → Confirmed
Revision history for this message
Krzysztof Tataradziński (ktatar156) wrote :

Regarding GPS fix I think that it's hardware problem (GPS used in Cortex), because I look at several android phones and here're my results:
- all phones tested with Snapdragon (Nexus 4, LG L fino, one HTC) get first fix below 10 seconds;
- all phones tested with Cortex (Lenovo A820, MX4, Kazam) getting first fix even till 2 minutes.
That makes all phones in market with Ubuntu (BQ, Meizu) are useless regarding in example using NearBy scope (without previous getting GPS fix in some navi app). Maybe solution to get phone more useful with features requiring GPS position is to release some phone with Snapdragon part (or GPS tested before and looked average time of first GPS fix)?
Does Canonical team tested that in oncoming MX5 Pro?

Changed in unity-scopes-api (Ubuntu):
status: Triaged → Invalid
Revision history for this message
Krzysztof Tataradziński (ktatar156) wrote :

Small update with MX4. I've switched from UT to Cyanogenmod 12.1 and tested GPS fix.
It get that fix in 2-3 seconds with data mobile and WiFi turned off! So problem isn't hardware, is software (at least in MX4).

Revision history for this message
Ferdinand Thommes (fe-thomm) wrote :

With the Pro 5, the problem still exists. Last year I reviewed the MX4 and NearBy located me in the city of Gemünden, about 500 KM away from my real location in Berlin. Refreshing did not work in most cases. The Pro 5 locates me in the exact same place that the MX4 did. I have no idea why location works sometimes but not always. Unfortunately I had to return the device today, so I can't be of any more help with debugging. So this is just a 'me too' and 'bug is still there' statemnent.

Other apps like HERE or uNav do fine with locating.

Revision history for this message
Matteo (mattbel10) wrote :

Nearby GPS positioning has got many problems. It is a very slow process at phone start-up and it doesn't work very well in my opinion. I'm in Italy, in Rome, and before to find the exact location, it takes always at least 4/5 attempts: it's frustrating. My phone is a BQ Aquaris E5. I have to tell also that same problems I find with HERE, Google Maps and uNav, sign that this is a Ubuntu Touch general problem.

Revision history for this message
Gabriele (gabrielemartelli) wrote :

The same problem for me.
A partial solution to the problem (at least aesthetic, so as not to leave the scope as a blank page) is the ability to save a fictional location that allows the scope to upload the location information and do not stay white. Only if the GPS provides location data, then the scope will return the updated values to the actual position

Gabriele

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.