2013-05-01 Mark Holland <mark@mark-holland.me.uk>
* src/pandroid/agent/PandroidAgentListener.java: Changed gps module to update coordinates after a time of "interval" AND "15 metres" if no change then uses lastKnownLocation. * Pandroid Agent v3.0_iso-8859-1.apk: Updated to latest version. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8093 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
1a933356a2
commit
93010856d8
|
@ -1,3 +1,11 @@
|
||||||
|
2013-05-01 Mark Holland <mark@mark-holland.me.uk>
|
||||||
|
|
||||||
|
* src/pandroid/agent/PandroidAgentListener.java: Changed gps module
|
||||||
|
to update coordinates after a time of "interval" AND "15 metres" if
|
||||||
|
no change then uses lastKnownLocation.
|
||||||
|
|
||||||
|
* Pandroid Agent v3.0_iso-8859-1.apk: Updated to latest version.
|
||||||
|
|
||||||
2013-04-28 Mark Holland <mark@mark-holland.me.uk>
|
2013-04-28 Mark Holland <mark@mark-holland.me.uk>
|
||||||
|
|
||||||
* layout/spinner.xml: Changed spinnner text color to green.
|
* layout/spinner.xml: Changed spinnner text color to green.
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -560,101 +560,73 @@ public class PandroidAgentListener extends Service {
|
||||||
return module_xml;
|
return module_xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void gpsLocation(){
|
|
||||||
|
|
||||||
|
|
||||||
//Start a location listener
|
|
||||||
LocationListener onLocationChange=new LocationListener() {
|
|
||||||
public void onLocationChanged(Location loc) {
|
|
||||||
Log.d("latitude",""+loc.getLatitude());
|
|
||||||
Log.d("Longitude",""+loc.getLongitude());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onProviderDisabled(String provider) {
|
|
||||||
// required for interface, not used
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onProviderEnabled(String provider) {
|
|
||||||
// required for interface, not used
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStatusChanged(String provider, int status,
|
|
||||||
Bundle extras) {
|
|
||||||
// required for interface, not used
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
locmgr.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,10000.0f,onLocationChange);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// private void gpsLocation() {
|
|
||||||
// // Starts with GPS, if no GPS then gets network location
|
private void gpsLocation() {
|
||||||
|
// Starts with GPS, if no GPS then gets network location
|
||||||
//
|
//
|
||||||
// LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||||
// List<String> providers = lm.getProviders(true);
|
List<String> providers = lm.getProviders(true);
|
||||||
// Log.d("PANDROID providers count", "" + providers.size());
|
Log.d("PANDROID providers count", "" + providers.size());
|
||||||
//
|
|
||||||
//// /* Loop over the array backwards, and if you get an accurate location, then break out the loop*/
|
/* Loop over the array backwards, and if you get an accurate location, then break out the loop*/
|
||||||
//// Location loc = null;
|
Location loc = null;
|
||||||
////
|
|
||||||
//// for (int i=providers.size()-1; i>=0; i--) {
|
for (int i=providers.size()-1; i>=0; i--) {
|
||||||
//// Log.d("PANDROID providers", providers.get(i));
|
Log.d("PANDROID providers", providers.get(i));
|
||||||
//// loc = lm.getLastKnownLocation(providers.get(i));
|
loc = lm.getLastKnownLocation(providers.get(i));
|
||||||
//// if (loc != null) break;
|
if (loc != null) break;
|
||||||
//// }
|
}
|
||||||
////
|
|
||||||
//// if (loc != null) {
|
if (loc != null) {
|
||||||
//// Log.d("PANDROID", "loc != null");
|
Log.d("PANDROID", "loc != null");
|
||||||
//// //if(latitude != loc.getLatitude() || longitude != loc.getLongitude()) {
|
//if(latitude != loc.getLatitude() || longitude != loc.getLongitude()) {
|
||||||
//// lastGpsContactDateTime = getHumanDateTime(-1);
|
lastGpsContactDateTime = getHumanDateTime(-1);
|
||||||
//// //`}
|
//`}
|
||||||
//// Log.d("LATITUDE",Double.valueOf(loc.getLatitude()).toString());
|
Log.d("LATITUDE",Double.valueOf(loc.getLatitude()).toString());
|
||||||
//// Log.d("LONGITUDE",Double.valueOf(loc.getLongitude()).toString());
|
Log.d("LONGITUDE",Double.valueOf(loc.getLongitude()).toString());
|
||||||
//// putSharedData("PANDROID_DATA", "latitude", Double.valueOf(loc.getLatitude()).toString(), "float");
|
putSharedData("PANDROID_DATA", "latitude", Double.valueOf(loc.getLatitude()).toString(), "float");
|
||||||
//// putSharedData("PANDROID_DATA", "longitude", Double.valueOf(loc.getLongitude()).toString(), "float");
|
putSharedData("PANDROID_DATA", "longitude", Double.valueOf(loc.getLongitude()).toString(), "float");
|
||||||
//// }
|
}
|
||||||
//// else {
|
Criteria criteria = new Criteria();
|
||||||
// Criteria criteria = new Criteria();
|
criteria.setAccuracy(Criteria.ACCURACY_COARSE);
|
||||||
// criteria.setAccuracy(Criteria.ACCURACY_COARSE);
|
criteria.setPowerRequirement(Criteria.POWER_LOW);
|
||||||
// criteria.setPowerRequirement(Criteria.POWER_LOW);
|
criteria.setAltitudeRequired(false);
|
||||||
// criteria.setAltitudeRequired(false);
|
criteria.setBearingRequired(false);
|
||||||
// criteria.setBearingRequired(false);
|
criteria.setCostAllowed(true);
|
||||||
// criteria.setCostAllowed(true);
|
String bestProvider = lm.getBestProvider(criteria, true);
|
||||||
// String bestProvider = lm.getBestProvider(criteria, true);
|
|
||||||
//
|
// If not provider found, abort GPS retrieving
|
||||||
// // If not provider found, abort GPS retrieving
|
if (bestProvider == null) {
|
||||||
// if (bestProvider == null) {
|
Log.e("LOCATION", "No location provider found!");
|
||||||
// Log.e("LOCATION", "No location provider found!");
|
return;
|
||||||
// return;
|
}
|
||||||
// }
|
|
||||||
//
|
lm.requestLocationUpdates(bestProvider, Core.interval, 15,
|
||||||
// lm.requestLocationUpdates(bestProvider, Core.defaultInterval, 1000,
|
new LocationListener() {
|
||||||
// new LocationListener() {
|
public void onLocationChanged(Location location) {
|
||||||
// public void onLocationChanged(Location location) {
|
Log.d("Best latitude", Double.valueOf(location.getLatitude()).toString());
|
||||||
// Log.d("Best latitude", Double.valueOf(location.getLatitude()).toString());
|
putSharedData("PANDROID_DATA", "latitude",
|
||||||
// putSharedData("PANDROID_DATA", "latitude",
|
Double.valueOf(location.getLatitude()).toString(), "float");
|
||||||
// Double.valueOf(location.getLatitude()).toString(), "float");
|
Log.d("Best longitude", Double.valueOf(location.getLongitude()).toString());
|
||||||
// Log.d("Best longitude", Double.valueOf(location.getLongitude()).toString());
|
putSharedData("PANDROID_DATA", "longitude",
|
||||||
// putSharedData("PANDROID_DATA", "longitude",
|
Double.valueOf(location.getLongitude()).toString(), "float");
|
||||||
// Double.valueOf(location.getLongitude()).toString(), "float");
|
}
|
||||||
// }
|
public void onStatusChanged(String s, int i, Bundle bundle) {
|
||||||
// public void onStatusChanged(String s, int i, Bundle bundle) {
|
|
||||||
//
|
}
|
||||||
// }
|
public void onProviderEnabled(String s) {
|
||||||
// public void onProviderEnabled(String s) {
|
// try switching to a different provider
|
||||||
// // try switching to a different provider
|
}
|
||||||
// }
|
public void onProviderDisabled(String s) {
|
||||||
// public void onProviderDisabled(String s) {
|
putSharedData("PANDROID_DATA", "enabled_location_provider",
|
||||||
// putSharedData("PANDROID_DATA", "enabled_location_provider",
|
"disabled", "string");
|
||||||
// "disabled", "string");
|
}
|
||||||
// }
|
});
|
||||||
// });
|
//}
|
||||||
// //}
|
|
||||||
//
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
private void batteryLevel() {
|
private void batteryLevel() {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue