Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Getting fake GPS info on some devices (Location event triggered even if GPS is off)
Started by Gerard J. Aug 23 2014 12:10 PM

5 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Gerard J.

[GLOBAL: userInfoPane.html]
Gerard J.
  • Observer

  • 20 posts
  • Corona SDK

Greetings.

 

I am currently working on a gps app, however I have encountered a big issue and so far hae found no solution.

In about half of the devices I've tested the "location" event gets triggered even if GPS is not enabled. Apparently it shows the last info provided by the GPS, even if it was many hours ago.

 

In other devices as soon as I turn GPS off I stop receiving location events. (which is the desired behavior)

 

I've removed the COARSE_LOCATION permission thining that it could be caused by the internet network but it still happens.

 

Has anybody encountered this same issue? any ideas on how to avoid it?

 

Is there any component of the location event that specifies what triggered the event? (gps, wifi, other) If the documentation is correct, there's no way but it would be very useful  I've tried to print the event table but table.concat won't work.

 

Any other way to discard fake location events?

 

 

 

Perhaps I'm ovelooking something simple or obvious?

Is there a way to check if GPS is on or off?

 

 

Edit: It must be that I'm failingo to add something, my code must be right because I observe the exact same issue in the GPS app ncluded with Corona samples.

 

Edit 2: It isn't happening on 2189, so anywhere I can check the changes to location event?

 

 

Thanks.



[TOPIC: post.html]
#2

Gerard J.

[GLOBAL: userInfoPane.html]
Gerard J.
  • Observer

  • 20 posts
  • Corona SDK

I know you're probably not supoosed to make double posts,  but I really, really need some light on this matter.

 

 

As I said, I'm not experiencing this issue on the 2189 release. But it supposedly doesn't comply with google play requirements (the ones that were supposed to start on August 1, and main reason a new version of Corona was needed) so I can't advertise.

 

Is there a workaround to this issue?

Any chance it gets solved?

 

Thanks.



[TOPIC: post.html]
#3

joedavinci

[GLOBAL: userInfoPane.html]
joedavinci
  • Enthusiast

  • 48 posts
  • Corona SDK

i haven't run into anything like this yet.

i dunno what kind of app you are building so maybe it will help and maybe it won't, but i'd look for a workaround...

 

i.e. -

1) check location's event.time,

2) compare it to os.time()

3) if the difference is more that X (for example 1 hour) then discard the location data as invalid...

 

i know it's not ideal, but i'm also slowly learning that with corona you sometimes have to take workarounds and non-ideal solutions to get above a limitation or a minor bug

 

 

not sure if your fake GPS events are logging your current time, or the time when the event was actually triggered in the past? if it records current time, i guess you are SOL



[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,649 posts
  • Enterprise

I saw at least one GPS related update in daily build 2381.  Your issue could be a regression bug, or perhaps the update fixes a bug you might be taking advantage of.

 

We can't do anything without a bug report, with a sample program that demonstrates the issue for the Engineers to see what's happening.  This sample app should be in a .zip file (no other type) and include your config.lua and build.settings file.

 

Use the "Report a bug" link at the top of the page.

 

Rob



[TOPIC: post.html]
#5

dgaedcke

[GLOBAL: userInfoPane.html]
dgaedcke
  • Contributor

  • 264 posts
  • Corona SDK

has anyone found a way to "spoof" (fake) the location services info....

 

for testing GPS based apps, we need to be able to fake different locations

 

Doing this is built into Xcode (Debug>>Simulate Location)  but I can't find a way to do it with a Corona (non Xcode) project.

 

All tips appreciated!



[TOPIC: post.html]
#6

heftyApps

[GLOBAL: userInfoPane.html]
heftyApps
  • Contributor

  • 102 posts
  • Corona SDK

I had to deal with this issue as as well (cached GPS data), at least on Android devices. I understand that this is not a Corona bug but rather an Android "feature". Have a look here: http://developer.android.com/guide/topics/location/strategies.html

 

What I did for my app is that my code ignores the first two GPS signals/events which provide latitude/longitude information. After that, GPS data should be up to date with no cached information being provided and this is when my app starts to use that data. Hope that helps.

 

Jens




[topic_controls]
[/topic_controls]