java - Android LocationManager, rough data and battery consumption -


i need rough data location on android, when getting main consideration keep battery power. consider code:

    locationmanager locationmanager = (locationmanager) getsystemservice(context.location_service);     locationmanager.requestlocationupdates(locationmanager.network_provider, 10 * 60 * 1000, 1000, this); 

is right strategy? or better check, every 10 minutes new location , disable listener, seems closer code proposed on google's site, though less logical me?

instead of mentioning provider name use criteria get provider. and, use criteria set requirement.

criteria criteria = new criteria(); criteria.setaccuracy(criteria.accuracy_fine); criteria.setaltituderequired(false); criteria.setbearingrequired(false); criteria.setcostallowed(true); criteria.setpowerrequirement(criteria.power_low); final string bestprovider = manager.getbestprovider(criteria, true); 

and finally,

locationmanager.requestlocationupdates(bestprovider, 0,1000, this); 

alternatively can request single location update or disable listener done task


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -