kopia lustrzana https://github.com/ge0rg/aprsdroid
fail properly for SM without GPS support
rodzic
b002b9f0c3
commit
c668d248ab
|
@ -52,6 +52,7 @@
|
|||
<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>
|
||||
<string name="service_sm_no_gps">SmartBeaconing™ requires GPS!</string>
|
||||
<!-- service result codes -->
|
||||
<string name="post_error">Error</string>
|
||||
<string name="post_incmg">received</string>
|
||||
|
|
|
@ -17,8 +17,14 @@ class SmartBeaconing(service : AprsService, prefs : PrefsWrapper) extends Locati
|
|||
def start(singleShot : Boolean) = {
|
||||
lastLoc = null
|
||||
stop()
|
||||
locMan.requestLocationUpdates(PeriodicGPS.bestProvider(locMan),
|
||||
0, 0, this)
|
||||
try {
|
||||
locMan.requestLocationUpdates(LocationManager.GPS_PROVIDER,
|
||||
0, 0, this)
|
||||
} catch {
|
||||
case e : IllegalArgumentException =>
|
||||
// this device does not have GPS. Oops.
|
||||
service.postAbort(service.getString(R.string.service_sm_no_gps))
|
||||
}
|
||||
service.getString(R.string.p_source_smart)
|
||||
}
|
||||
|
||||
|
@ -106,7 +112,7 @@ class SmartBeaconing(service : AprsService, prefs : PrefsWrapper) extends Locati
|
|||
Log.d(TAG, "onProviderDisabled: " + provider)
|
||||
if (provider == LocationManager.GPS_PROVIDER) {
|
||||
// GPS was our last data source, we have to complain!
|
||||
Toast.makeText(service, R.string.service_no_location, Toast.LENGTH_LONG).show()
|
||||
Toast.makeText(service, R.string.service_sm_no_gps, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
override def onProviderEnabled(provider : String) {
|
||||
|
|
Ładowanie…
Reference in New Issue