location provider improvement, message

service_trace
Georg Lukas 2011-07-15 15:18:25 +02:00
rodzic 57396a3868
commit 2784015a80
3 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -43,6 +43,7 @@
<string name="service_once">APRS Service single shot.</string>
<string name="service_start">APRS Service started. Updates every %1$d minutes, %2$d km.</string>
<string name="service_stop">APRS Service stopped.</string>
<string name="service_no_location">You need to enable either GPS or Network Location for APRSdroid to work properly!</string>
<!-- first run dialog -->
<string name="fr_title">Welcome to APRSdroid!</string>

Wyświetl plik

@ -264,6 +264,13 @@ class AprsService extends Service with LocationListener {
override def onProviderDisabled(provider : String) {
Log.d(TAG, "onProviderDisabled: " + provider)
val netloc_available = locMan.getProviders(true).contains(LocationManager.NETWORK_PROVIDER)
val netloc_usable = netloc_available && prefs.getBoolean("netloc", false)
if (provider == LocationManager.GPS_PROVIDER &&
netloc_usable == false) {
// GPS was our last data source, we have to complain!
Toast.makeText(this, R.string.service_no_location, Toast.LENGTH_LONG).show()
}
}
override def onProviderEnabled(provider : String) {
Log.d(TAG, "onProviderEnabled: " + provider)

Wyświetl plik

@ -22,7 +22,7 @@ class TcpUploader(service : AprsService, prefs : PrefsWrapper) extends AprsIsUpl
val filterdist = prefs.getStringInt("tcp.filterdist", 50)
val userfilter = prefs.getString("tcp.filter", "")
val lastloc = AprsPacket.formatRangeFilter(
service.locMan.getLastKnownLocation(LocationManager.GPS_PROVIDER), filterdist)
service.locMan.getLastKnownLocation(LocationManager.PASSIVE_PROVIDER), filterdist)
if (filterdist == 0) return " filter %s %s".format(userfilter, lastloc)
else return " filter m/%d %s %s".format(filterdist, userfilter, lastloc)
}