Java Code Examples for android.location.LocationProvider#OUT_OF_SERVICE
The following examples show how to use
android.location.LocationProvider#OUT_OF_SERVICE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocationService.java From Androzic with GNU General Public License v3.0 | 6 votes |
@Override public void onStatusChanged(String provider, int status, Bundle extras) { if (enableMockLocations) return; if (LocationManager.GPS_PROVIDER.equals(provider)) { switch (status) { case LocationProvider.TEMPORARILY_UNAVAILABLE: case LocationProvider.OUT_OF_SERVICE: tearTrack(); updateNotification(); break; } } }
Example 2
Source File: LocationUtils.java From Android-UtilCode with Apache License 2.0 | 6 votes |
/** * provider的在可用、暂时不可用和无服务三个状态直接切换时触发此函数 * * @param provider 提供者 * @param status 状态 * @param extras provider可选包 */ @Override public void onStatusChanged(String provider, int status, Bundle extras) { if (mListener != null) { mListener.onStatusChanged(provider, status, extras); } switch (status) { case LocationProvider.AVAILABLE: LogUtils.d("onStatusChanged", "当前GPS状态为可见状态"); break; case LocationProvider.OUT_OF_SERVICE: LogUtils.d("onStatusChanged", "当前GPS状态为服务区外状态"); break; case LocationProvider.TEMPORARILY_UNAVAILABLE: LogUtils.d("onStatusChanged", "当前GPS状态为暂停服务状态"); break; } }
Example 3
Source File: RxLocationTool.java From RxTools-master with Apache License 2.0 | 6 votes |
/** * provider的在可用、暂时不可用和无服务三个状态直接切换时触发此函数 * * @param provider 提供者 * @param status 状态 * @param extras provider可选包 */ @Override public void onStatusChanged(String provider, int status, Bundle extras) { if (mListener != null) { mListener.onStatusChanged(provider, status, extras); } switch (status) { case LocationProvider.AVAILABLE: Log.d("onStatusChanged", "当前GPS状态为可见状态"); break; case LocationProvider.OUT_OF_SERVICE: Log.d("onStatusChanged", "当前GPS状态为服务区外状态"); break; case LocationProvider.TEMPORARILY_UNAVAILABLE: Log.d("onStatusChanged", "当前GPS状态为暂停服务状态"); break; } }
Example 4
Source File: GpsElement.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * {@inheritDoc} */ @Override public void onStatusChanged(String provider, int status, Bundle extras) { // Called when the provider status changes. Log.d(TAG, "Provider status changed: " + provider + " status: " + status); if (status == LocationProvider.AVAILABLE) { // Do nothing, we should get a location update soon which will // disable the listener. } else if (status == LocationProvider.OUT_OF_SERVICE || status == LocationProvider.TEMPORARILY_UNAVAILABLE) { getLocationButton.setEnabled(true); getLocationButton.setText( getString(R.string.gps_element_acquire_unavailable)); locationManager.removeUpdates(locationListener); } }
Example 5
Source File: LocationUtils.java From AndroidUtilCode with Apache License 2.0 | 6 votes |
/** * provider的在可用、暂时不可用和无服务三个状态直接切换时触发此函数 * * @param provider 提供者 * @param status 状态 * @param extras provider可选包 */ @Override public void onStatusChanged(String provider, int status, Bundle extras) { if (mListener != null) { mListener.onStatusChanged(provider, status, extras); } switch (status) { case LocationProvider.AVAILABLE: Log.d("LocationUtils", "当前GPS状态为可见状态"); break; case LocationProvider.OUT_OF_SERVICE: Log.d("LocationUtils", "当前GPS状态为服务区外状态"); break; case LocationProvider.TEMPORARILY_UNAVAILABLE: Log.d("LocationUtils", "当前GPS状态为暂停服务状态"); break; } }
Example 6
Source File: CollectorService.java From TowerCollector with Mozilla Public License 2.0 | 6 votes |
@Override public void onStatusChanged(String provider, int status, Bundle extras) { // on Android 10 this callback will never be invoked String statusString; switch (status) { case LocationProvider.AVAILABLE: statusString = "AVAILABLE"; break; case LocationProvider.OUT_OF_SERVICE: statusString = "OUT_OF_SERVICE"; break; case LocationProvider.TEMPORARILY_UNAVAILABLE: statusString = "TEMPORARILY_UNAVAILABLE"; break; default: statusString = "UNKNOWN"; break; } Timber.tag(INNER_TAG).d("onStatusChanged(): %s", statusString); }
Example 7
Source File: LocationUtils.java From DevUtils with Apache License 2.0 | 6 votes |
/** * provider 的在可用、暂时不可用和无服务三个状态直接切换时触发此函数 * @param provider 提供者 * @param status 状态 * @param extras provider 可选包 */ @Override public void onStatusChanged(String provider, int status, Bundle extras) { if (sListener != null) { sListener.onStatusChanged(provider, status, extras); } switch (status) { case LocationProvider.AVAILABLE: LogPrintUtils.dTag(TAG, "当前 GPS 状态为可见状态"); break; case LocationProvider.OUT_OF_SERVICE: LogPrintUtils.dTag(TAG, "当前 GPS 状态为服务区外状态"); break; case LocationProvider.TEMPORARILY_UNAVAILABLE: LogPrintUtils.dTag(TAG, "当前 GPS 状态为暂停服务状态"); break; } }
Example 8
Source File: Engine.java From tilt-game-android with MIT License | 6 votes |
@Override public void onStatusChanged(final String pProvider, final int pStatus, final Bundle pExtras) { switch (pStatus) { case LocationProvider.AVAILABLE: this.mLocationListener.onLocationProviderStatusChanged(LocationProviderStatus.AVAILABLE, pExtras); break; case LocationProvider.OUT_OF_SERVICE: this.mLocationListener.onLocationProviderStatusChanged(LocationProviderStatus.OUT_OF_SERVICE, pExtras); break; case LocationProvider.TEMPORARILY_UNAVAILABLE: this.mLocationListener.onLocationProviderStatusChanged(LocationProviderStatus.TEMPORARILY_UNAVAILABLE, pExtras); break; default: throw new IllegalArgumentException("Unexpected " + LocationProvider.class.getSimpleName() + ": '" + pStatus + "'."); } }
Example 9
Source File: GPSApplication.java From GPSLogger with GNU General Public License v3.0 | 6 votes |
@Override public void onStatusChanged(String provider, int status, Bundle extras) { // This is called when the GPS status changes switch (status) { case LocationProvider.OUT_OF_SERVICE: //Log.w("myApp", "[#] GPSApplication.java - GPS Out of Service"); gpsunavailablehandler.removeCallbacks(unavailr); // Cancel the previous unavail countdown handler GPSStatus = GPS_OUTOFSERVICE; EventBus.getDefault().post(EventBusMSG.UPDATE_FIX); //Toast.makeText( getApplicationContext(), "GPS Out of Service", Toast.LENGTH_SHORT).show(); break; case LocationProvider.TEMPORARILY_UNAVAILABLE: //Log.w("myApp", "[#] GPSApplication.java - GPS Temporarily Unavailable"); gpsunavailablehandler.removeCallbacks(unavailr); // Cancel the previous unavail countdown handler GPSStatus = GPS_TEMPORARYUNAVAILABLE; EventBus.getDefault().post(EventBusMSG.UPDATE_FIX); //Toast.makeText( getApplicationContext(), "GPS Temporarily Unavailable", Toast.LENGTH_SHORT).show(); break; case LocationProvider.AVAILABLE: gpsunavailablehandler.removeCallbacks(unavailr); // Cancel the previous unavail countdown handler //Log.w("myApp", "[#] GPSApplication.java - GPS Available: " + _NumberOfSatellites + " satellites"); break; } }
Example 10
Source File: LocationService.java From trekarta with GNU General Public License v3.0 | 5 votes |
@Override public void onStatusChanged(String provider, int status, Bundle extras) { if (enableMockLocations && BuildConfig.DEBUG) return; if (LocationManager.GPS_PROVIDER.equals(provider)) { switch (status) { case LocationProvider.TEMPORARILY_UNAVAILABLE: case LocationProvider.OUT_OF_SERVICE: tearTrack(); updateNotification(); break; } } }
Example 11
Source File: InstrumentationService.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void onStatusChanged(String provider, int status, Bundle extras) { Log.d(TAG, "LocationListener.onStatusChanged(...)"); if (status == LocationProvider.AVAILABLE) { // Do nothing, we should get a location update soon which will // disable the listener. } else if (status == LocationProvider.OUT_OF_SERVICE || status == LocationProvider.TEMPORARILY_UNAVAILABLE) { removeListener(id); stopSelf(id); } }
Example 12
Source File: Engine.java From 30-android-libraries-in-30-days with Apache License 2.0 | 5 votes |
@Override public void onStatusChanged(final String pProvider, final int pStatus, final Bundle pExtras) { switch(pStatus) { case LocationProvider.AVAILABLE: this.mLocationListener.onLocationProviderStatusChanged(LocationProviderStatus.AVAILABLE, pExtras); break; case LocationProvider.OUT_OF_SERVICE: this.mLocationListener.onLocationProviderStatusChanged(LocationProviderStatus.OUT_OF_SERVICE, pExtras); break; case LocationProvider.TEMPORARILY_UNAVAILABLE: this.mLocationListener.onLocationProviderStatusChanged(LocationProviderStatus.TEMPORARILY_UNAVAILABLE, pExtras); break; } }
Example 13
Source File: GeoPointActivity.java From commcare-android with Apache License 2.0 | 5 votes |
@Override public void onStatusChanged(String provider, int status, Bundle extras) { switch (status) { case LocationProvider.AVAILABLE: if (location != null) { locationDialog.setMessage(StringUtils.getStringRobust(this, R.string.location_accuracy, "" + (int)location.getAccuracy())); } break; case LocationProvider.OUT_OF_SERVICE: break; case LocationProvider.TEMPORARILY_UNAVAILABLE: break; } }
Example 14
Source File: AndroidLocationManager.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
private int convertStatus(int status) { switch (status) { case LocationProvider.AVAILABLE: return com.codename1.location.LocationManager.AVAILABLE; case LocationProvider.OUT_OF_SERVICE: return com.codename1.location.LocationManager.OUT_OF_SERVICE; case LocationProvider.TEMPORARILY_UNAVAILABLE: return com.codename1.location.LocationManager.TEMPORARILY_UNAVAILABLE; } return com.codename1.location.LocationManager.OUT_OF_SERVICE; }
Example 15
Source File: GPSLocationProvider.java From mappwidget with Apache License 2.0 | 5 votes |
private String statusToString(int status) { switch (status) { case LocationProvider.OUT_OF_SERVICE: return "OUT_OF_SERVICE"; case LocationProvider.TEMPORARILY_UNAVAILABLE: return "TEMPORARILY_UNAVAILABLE"; case LocationProvider.AVAILABLE: return "AVAILABLE:"; } return "UNKNOWN"; }
Example 16
Source File: LocationService.java From AndroidLocationStarterKit with MIT License | 5 votes |
@Override public void onStatusChanged(String provider, int status, Bundle extras) { if (provider.equals(LocationManager.GPS_PROVIDER)) { if (status == LocationProvider.OUT_OF_SERVICE) { notifyLocationProviderStatusUpdated(false); } else { notifyLocationProviderStatusUpdated(true); } } }
Example 17
Source File: LocationSensor.java From appinventor-extensions with Apache License 2.0 | 5 votes |
@Override public void onStatusChanged(String provider, int status, Bundle extras) { switch (status) { // Ignore TEMPORARILY_UNAVAILABLE, because service usually returns quickly. case LocationProvider.TEMPORARILY_UNAVAILABLE: StatusChanged(provider, "TEMPORARILY_UNAVAILABLE"); break; case LocationProvider.OUT_OF_SERVICE: // If the provider we were listening to is no longer available, // find another. StatusChanged(provider, "OUT_OF_SERVICE"); if (provider.equals(providerName)) { stopListening(); RefreshProvider("onStatusChanged"); } break; case LocationProvider.AVAILABLE: // If another provider becomes available and is one we hadn't known // about see if it is better than the one we're currently using. StatusChanged(provider, "AVAILABLE"); if (!provider.equals(providerName) && !allProviders.contains(provider)) { RefreshProvider("onStatusChanged"); } break; } }
Example 18
Source File: GPSListenersMaker.java From apollo-DuerOS with Apache License 2.0 | 5 votes |
public void onStatusChanged(String provider, int status, Bundle extras) { switch (status) { case LocationProvider.AVAILABLE: break; case LocationProvider.OUT_OF_SERVICE: break; case LocationProvider.TEMPORARILY_UNAVAILABLE: break; default: break; } }
Example 19
Source File: LocationModule.java From react-native-GPay with MIT License | 5 votes |
@Override public void onStatusChanged(String provider, int status, Bundle extras) { if (status == LocationProvider.OUT_OF_SERVICE) { emitError(PositionError.POSITION_UNAVAILABLE, "Provider " + provider + " is out of service."); } else if (status == LocationProvider.TEMPORARILY_UNAVAILABLE) { emitError(PositionError.TIMEOUT, "Provider " + provider + " is temporarily unavailable."); } }
Example 20
Source File: NmeaParser.java From UsbGps4Droid with GNU General Public License v3.0 | 4 votes |
public void disableMockLocationProvider() { try { LocationProvider prov; if (mockLocationProvider != null && !mockLocationProvider.equals("") && mockGpsEnabled) { prov = lm.getProvider(mockLocationProvider); if (prov != null) { log("Mock provider: " + prov.getName() + " " + prov.getPowerRequirement() + " " + prov.getAccuracy() + " " + lm.isProviderEnabled(mockLocationProvider)); } mockGpsEnabled = false; if (mockGpsAutoEnabled) { log("disabling Mock provider: " + mockLocationProvider); lm.setTestProviderEnabled(mockLocationProvider, false); } prov = lm.getProvider(mockLocationProvider); if (prov != null) { log("Mock provider: " + prov.getName() + " " + prov.getPowerRequirement() + " " + prov.getAccuracy() + " " + lm.isProviderEnabled(mockLocationProvider)); } lm.clearTestProviderEnabled(mockLocationProvider); prov = lm.getProvider(mockLocationProvider); if (prov != null) { log("Mock provider: " + prov.getName() + " " + prov.getPowerRequirement() + " " + prov.getAccuracy() + " " + lm.isProviderEnabled(mockLocationProvider)); } lm.clearTestProviderStatus(mockLocationProvider); lm.removeTestProvider(mockLocationProvider); prov = lm.getProvider(mockLocationProvider); if (prov != null) { log("Mock provider: " + prov.getName() + " " + prov.getPowerRequirement() + " " + prov.getAccuracy() + " " + lm.isProviderEnabled(mockLocationProvider)); } log("removed mock GPS"); } else { log("Mock provider already disabled: " + mockLocationProvider); } } catch (SecurityException e) { logError("Error while enabling Mock Mocations Provider", e); } finally { mockLocationProvider = null; mockGpsEnabled = false; mockGpsAutoEnabled = false; mockStatus = LocationProvider.OUT_OF_SERVICE; } }