Android Question FusedLocationProvider ConnectionSuccess event raises with gps turned off

Mike1970

Well-Known Member
Licensed User
Longtime User
Hi everyone, i'm using the FLP instead of the classic GPS, but i noticed that the event "ConnectionSuccess" raises even if the gps (and wifi) is turned off.
Why?
(i was trying to raise the "ConnectionFailed" event)
Thanks
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
FLP gets the best possible location. It can be a location got from wifi. I don´t know exactly how it works. But the Androidsystem returns a Location somehow.
I guess it just responds that it gets a Location. I don´t think it is related to GPS (only).
https://developers.google.com/location-context/fused-location-provider

Yes i know, it uses gps, wifi, and something else, the problem is that I turned off EVERYTHING, (basically airplane mode).

The "ConnectionSuccess" event raises anyway, but it doesn't find any location. Just "ConnectionSuccess", not "LocationChanged"
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
The ConnectionSuccess event is raised when the
GoogleApiClient.ConnectionCallbacks onConnected() method is called.

The documentation states:
Provides callbacks that are called when the client is connected or disconnected from the service.

What does it mean by 'the service'?
It has nothing to do with location sources, i guess it means it's connected to an android framework service.
Once connected to 'the service' the FusedLocationProvider can then request locations.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
The additional method of location detection I believe is with cell tower triangulation. The radio in the device can list what cell towers are within range of the device and their relative signal strength to each. And since cell tower locations are documented known locations, a rough position can be calculated using math of all the values.

Thus theoretically, if you truly turn on "Airplane" mode (not just turn off WiFi and Bluetooth), then that should prevent the radio in the device from seeing the cell towers anymore and could stop the events from triggering.
 
Last edited:
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Also, from what I understand, Wifi can be used to obtain your location using two ways:

1) Google's streetview car was claimed to record all the wifi ap's (and it's mac address) it sees as it drives around and logs the location of each and puts it into googles database.
2) When your device obtains a gps/cell location AND if you are connected to a Wifi AP, I believe it sends the AP name, Mac address and the location back to google servers so when other devices are connected to that wifi ap, google will know the location even if gps is turned off.
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
The additional method of location detection I believe is with cell tower triangulation. The radio in the device can list what cell towers are within range of the device and their relative signal strength to each. And since cell tower locations are documented known locations, a rough position can be calculated using math of all the values.

Thus theoretically, if you truly turn on "Airplane" mode (not just turn off WiFi and Bluetooth), then that should prevent the radio in the device from seeing the cell towers anymore and could stop the events from triggering.

I turned off Wifi and GPS, beacuse I even haven't got a Sim card in the phone i'm using, so it can't use Cell tower
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
The ConnectionSuccess event is raised when the
GoogleApiClient.ConnectionCallbacks onConnected() method is called.

The documentation states:


What does it mean by 'the service'?
It has nothing to do with location sources, i guess it means it's connected to an android framework service.
Once connected to 'the service' the FusedLocationProvider can then request locations.

Oh ok.. so, when will the "ConnectionFailed" event raise, if the connection is an internal thing that does not require internet/gps ?
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Oh ok.. so, when will the "ConnectionFailed" event raise, if the connection is an internal thing that does not require internet/gps ?

ConnectionFailed will be raised if your b4a code fails to connect to the Google API framework.
I've no idea what would cause that to happen.

It's probably best to say that ConnectionSuccess and ConnectionFailed events relate to your b4a code connecting to the Google API framework and have nothing at all to do with GPS locations.
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
ConnectionFailed will be raised if your b4a code fails to connect to the Google API framework.
I've no idea what would cause that to happen.

It's probably best to say that ConnectionSuccess and ConnectionFailed events relate to your b4a code connecting to the Google API framework and have nothing at all to do with GPS locations.
Ok thanks, very clear.
Maybe I will try to use th GPS events since the library is already imported to get working the FLP
 
Upvote 0
Top