onLocationChanged() not called on Android device - android

I have some trobule using Google Maps API on Android.
In onLocationChanged() I create an overlay and add it to the MapView, which works fine on the emulator using Android 2.1, but when I try to debug on a device, nothing happens. What could be the problem?
The device is Sony Ericsson Xperia Arc with Android 2.3.
Thanks, Ivan.

Real devices does not always get GPS signals, especially indoors. I guess you should use NetworkProvider in your listener if GPS is not available.
This is a good reference
http://android-developers.blogspot.com/2011/06/deep-dive-into-location.html

Wait for the device get the fix, sometimes the GPS needs more time than usual.

Related

Incorrect GPS location reported by Google maps in Genymotion

I'm using the Genymotion emulator to test my android application that needs location with GPS.
When I launch the Google Maps application, it gives me an incorrect location. Anyone have any idea about that?
There is several solutions for your problem:
You can choose the GPS position of a Genymotion emulator thanks to the GPS widget on the right side of the screen.
You can also do it by shell commmand, look at the documentation here
Or, if you have a pro license, you can do it by the Java API (for unit test for example).
You need both the GPS on in Genymotion (where you can set the location it reports to the device as above) PLUS you need to turn on location services on the virtual device itself (under Settings/Location Services for 4.1.1 - may vary a little depending on which version of Android you are emulating).

Mocking gps locations in phonegap

I'm relatively new to Phonegap and I would like to know if there is a way to mock gps location on a android device using it or if using the Location class in android is the only way to do it?
Check the link below:
http://www.cs.nott.ac.uk/~cmg/G54UBI/coursework2/GPS_and_Maps.html
Getting GPS position
Using the location sensor in AppInventor:
http://www.cs.usfca.edu/~wolber/appinventor/locationsensor.html
Using GPS in JavaScript, including PhoneGap:
http://docs.phonegap.com/phonegap_geolocation_geolocation.md.html#Geolocation
Note the "quirk" at the bottom, i.e. to get mock GPS on the emulator you must set the option
"enableHighAccuracy" to "true".
It appears that there is a problem with mock locations on the Android 2.3.3 emulator (it seems to
crash/reboot the emulator). Please avoid using this version of the emulator; try Android 2.2 instead.

Android location fix inaccurate/old but Google Maps works

This is a strange issue which mostly appears on Samsung devices but I cannot confirm its only on Samsung.
My app won't get or update to the correct location fix. It listens to GPS, network and cell providers but the location fix I get is still outdated and inaccurate sometimes the fix is like a day earlier.
I thought it might be a bug in my code but then I opened other apps (Yelp, etc...) and they also have the same problem.
I then open Google Maps and the location is perfectly accurate and up-to-date.
Is this an Android platform bug? Do Maps use a different internal location source provider? Has anyone dealt with this issue before and can provide a solution?
I ran into the same issue.
It is an Android platform bug and it seems that this is an open issue that Google knows about:
https://code.google.com/p/android/issues/detail?id=57707
It is randomly happening.
Google maps is working because their location is based on Google services (Fused Location) which you can also use.
But they also have a bug with the january 2014 update: if you are outside and request a fastest location update rate (e.g. every second) and you are connected to the both network and gps receiver, you will receive a new location only at around 10 seconds even if gps is connected.
They ruined my app which used to work fine with this update and still not fixed to this day!
So what you can do is wait for the fix or use google location service fused location if it fits for you!
Go to settings>wifi>advanced and turn off ALWAYS ALLOW SCANNING

LocationListener Network provider not called

I'm facing a really annoying problem. In some point of the program, I
need to track the user position. For that I register a listener for
all the providers available and request updates. This was working
really good until I updated my phone to Android 4.0. But the same code
is working perfectly in older versions.
Now, the listener is not being called. But only under some conditions:
if i have gps coordinates, this works perfectly ok, even if the gps
coordinates are lost, I get also network
but if there is no gps coordinates and there is no wifi signal (but
the wifi on the phone is enable), I should be able to get the
coordinates using the 3g. Here is were it's not working. If I debug, I
can see how the listener is being registered but it is never called.
Please, help!!!!
Don't know whether you have gone through this.
If not, it would be useful for you.
Do you have a sim card in the device? I found this resolved the issue for me.
Incidentally, I found that after I upgraded my Galaxy Nexus to Android 4.x (specifically, 4.2.2) weird things started happening with my device. Perhaps this there are some bugs in the updates?

unable to get current location on SonyEricsson X10i

I am using SonyEricsson X10i phone. I have developend an application that just shows the current location of a user. Now the problem is When i turn on my application it just keep searching. It is not showing anything. Even if i try to use built in navigation system it does not work. I have turned on GPS receiver. My firmware version is 1.6 and kernel version is 2.6. I am not sure but i came to know from some resource that 1.6 firmware does not support GPS. Let me know if someone knows the solution.
Are you indoor or outdoor? GPS
usually only works well outdoor.
Do you
have turned 'network' as a data
source on in your location settings?
Allowing triangulation/cell
towers/wifi networks to get the
location if GPS/satellite is not
available.

Categories

Resources