java - Android Google Play Services GPS not sending location -



java - Android Google Play Services GPS not sending location -

i've create application track user's location gps doesn't seem send location.

also doesn't seem gps disconnected because i've set logs , there no log indicating gps disconnect.

it looks stop calling onlocationchanged sometime works again.

here illustration of issue. can see i'm going through buildings ....

i've set partial wake lock after research online doesn't seem work.

so start application , force powerfulness button on phone turn screen off , start driving. arriving @ destination open app , stop application.

it doesn't happen time.

any thought on causing this?

thanks,

here code :

public class locationservice extends service implements connectioncallbacks, onconnectionfailedlistener, locationlistener { private static logger logger = loggerfactory.getlogger(locationservice.class); private final ibinder _binder = new localbinder(); private locationclient _locationclient; private locationrequest request = locationrequest.create() .setpriority(locationrequest.priority_high_accuracy) .setinterval(5000) .setfastestinterval(1000) .setsmallestdisplacement(5); public class localbinder extends binder { public locationservice getservice() { homecoming locationservice.this; } } private powermanager.wakelock wakelock; @override public void oncreate() { super.oncreate(); logger.debug("oncreate"); powermanager mgr = (powermanager)this.getsystemservice(context.power_service); wakelock = mgr.newwakelock(powermanager.partial_wake_lock, "wake lock"); } public int onstartcommand (intent intent, int flags, int startid) { super.onstartcommand(intent, flags, startid); logger.debug("onstartcommand"); homecoming start_sticky; } @override public ibinder onbind(intent intent) { homecoming _binder; } @override public void ondestroy(){ super.ondestroy(); logger.debug("ondestroy"); if(_locationclient != null) { stopacquiringlocation(); _locationclient = null; } if(wakelock.isheld()) wakelock.release(); } @override public void onlocationchanged(location location) { logger.debug("location: "+location.getlatitude()+","+location.getlongitude() +" accurracy: "+location.getaccuracy() + " time:"+new date(location.gettime())); if(location.getaccuracy() <= 15) { //save location } } @override public void onconnected(bundle bundle) { logger.info("gps connected"); // request location updates using static settings getlocationclient().requestlocationupdates(request, this); } @override public void ondisconnected() { logger.info("gps disconnected"); if(_locationclient != null) { stopacquiringlocation(); _locationclient = null; } } @override public void onconnectionfailed(connectionresult connectionresult) { logger.info("gps connectionfailed "+connectionresult.tostring()); } private locationclient getlocationclient() { if(_locationclient == null) _locationclient = new locationclient(this, this, this); homecoming _locationclient; } public void startacquiringlocation() { if(util.isgoogleplayserviceavailable(this)) { if (!getlocationclient().isconnected() || !getlocationclient().isconnecting()) { logger.debug("getlocationclient().connect()"); getlocationclient().connect(); if(wakelock.isheld() == false) wakelock.acquire(); } } else { logger.warn("no google play services available"); } } public void stopacquiringlocation() { if(util.isgoogleplayserviceavailable(this)) { if (getlocationclient().isconnected() || getlocationclient().isconnecting()) { getlocationclient().removelocationupdates(this); getlocationclient().disconnect(); logger.debug("getlocationclient().disconnect()"); if(wakelock.isheld()) wakelock.release(); } } } }

hard without code. first thing seek - testing app outside - using another, similar app , see, if there problem app or hardware issue inbuilt gps.

the values of min_distance_for_updates , min_time_bw_updates reasonable?

energy saving mode enabled in phone can lead less frequent gps position updates.

i think, more suggestions, code required.

java android gps

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -