LocationManager removeGpsStatusListener - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for LocationManager removeGpsStatusListener method.

This code example shows how to use the following methods:removeGpsStatusListener, removeUpdates
	public void requestLocationUpdates(boolean request) {
		if (request) {
			lmgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,	this);
			lmgr.addGpsStatusListener(this);
		} else { 
			lmgr.removeUpdates(this);
			lmgr.removeGpsStatusListener(this);
		} 
	} 
 
	@Override 
	public void onGpsStatusChanged(int event) {
		// Update GPS Status image according to event 
		ImageView imgSatIndicator = (ImageView) findViewById(R.id.gpsstatus_record_imgSatIndicator);
 
		switch (event) {
		case GpsStatus.GPS_EVENT_FIRST_FIX:
			imgSatIndicator.setImageResource(R.drawable.sat_indicator_0);
			activity.onGpsEnabled();
			break; 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addGpsStatusListener, addNmeaListener, removeGpsStatusListener, removeNmeaListener, removeUpdates
		timer.postDelayed(this, 5000);
	} 
	 
	public synchronized void disable() 
	{ 
		locationManager.removeUpdates(this);
		locationManager.removeNmeaListener(this);
		locationManager.removeGpsStatusListener(this);
		enable = false;
	} 
	 
	public synchronized void enableGpsProvider(Looper looper)
	{ 
		disable(); 
		locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, this,looper);
		locationManager.addNmeaListener(this);
		locationManager.addGpsStatusListener(this);
		enable = true;
	} 
	 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:removeGpsStatusListener, removeNmeaListener
 
	@Override 
	protected void onPause() { 
		//Remove listener 
		LocationManager lLocMan=mLocMan;
		lLocMan.removeGpsStatusListener(this);
		lLocMan.removeNmeaListener(this);
		super.onPause(); 
		 
	} 
 
	@Override 
	protected void onResume() { 
		super.onResume(); 
		LocationManager lLocMan=mLocMan;
		//register for the GPS status listener 
		lLocMan.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
		lLocMan.addGpsStatusListener(this);
		lLocMan.addNmeaListener(this);
		 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:removeGpsStatusListener, removeNmeaListener, removeUpdates
                LocationManager.GPS_PROVIDER, 0, 0, locationListener);
    } 
 
    public void shutdown() { 
        try { 
            locationManager.removeGpsStatusListener(gpsStatusListener);
            locationManager.removeNmeaListener(nmeaListener);
            locationManager.removeUpdates(locationListener);
        } catch (Exception e) {
            e.printStackTrace();
        } 
    } 
 
    private class MyLocationListener implements LocationListener {
        public void onLocationChanged(Location location) {
            mCallbackListener.onGpsLocationUpdate(location.getTime(), location.getAccuracy(),
                    location.getLatitude(), location.getLongitude(), location.getAltitude(),
                    location.getBearing(), location.getSpeed());
        } 
 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:removeGpsStatusListener, removeUpdates
 
	@Override 
	protected void onPause() { 
		super.onPause(); 
		LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
		locationManager.removeGpsStatusListener(this);
		locationManager.removeUpdates(this);
		Log.d(TAG, "Pause: disabled Location callbacks");
	} 
 
	@Override 
	protected void onResume() { 
		super.onResume(); 
		LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
		locationManager.addGpsStatusListener(this);
		locationManager.requestLocationUpdates(GPS_PROVIDER, 0, 0, this);
		Location loc = locationManager.getLastKnownLocation(GPS_PROVIDER);
		updateLocation(loc);
		updateEnabled(locationManager.isProviderEnabled(GPS_PROVIDER));
		Log.d(TAG, "Resume	: enabled Location callbacks");
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:removeGpsStatusListener, removeNmeaListener, removeUpdates
    private void unregisterListeners() { 
        sensorMan.unregisterListener(accelerometerLog);
        sensorMan.unregisterListener(magneticLog);
        sensorMan.unregisterListener(orientationLog);
 
        locMan.removeGpsStatusListener(gpsStatusListener);
        locMan.removeNmeaListener(gpsNmeaListener);
        locMan.removeUpdates(locationLog);
 
        telMan.listen(telephonyLog.phoneStateListener,
                PhoneStateListener.LISTEN_NONE);
 
        unregisterReceiver(batteryLog.batteryListener);
 
        logcatLog.stop();
    } 
 
    private void showNotification() { 
        Notification notification = new Notification(R.drawable.icon,
                "SquirrelLog", System.currentTimeMillis());
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:removeGpsStatusListener, removeUpdates
	 
	public void stopListening() { 
		// Unregisterlistener moved to thread 
		mRunning = false;
		unregister_GPS(); 
		mLocationManager.removeUpdates(this);
		// End recording thread 
		mThread.interrupt();
		mThread = null;
	} 
	 
    private void register_with_GPS() 
    { 
    	try 
    	{ 
    		if(mLocationManager.addGpsStatusListener(this)) // && mLocationManager.addNmeaListener(this))
    		{ 
            	Toast.makeText(mContext, "GPS Connected", Toast.LENGTH_SHORT).show();        	        	    			
    		} 
    	} 

4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:removeGpsStatusListener, removeUpdates
	} 
 
	@Override 
	protected void onDestroy() { 
		super.onDestroy(); 
		this.manager.removeUpdates(this);
		this.manager.removeGpsStatusListener(this);
	} 
 
	@Override 
	protected boolean isRouteDisplayed() { 
		return false; 
	} 
 
	@Override 
	protected boolean isLocationDisplayed() { 
		return false; 
	} 
 
	@Override 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:removeGpsStatusListener, removeUpdates
	protected void onPause() { 
		super.onPause(); 
		 
		if (locationManager != null) {
			// remove the delegates to stop the GPS 
			locationManager.removeGpsStatusListener(gpsListener);
			locationManager.removeUpdates(gpsListener);
			locationManager = null;
		} 
	} 
	 
	private void updateView() { 
		 
		// update all data in the UI 
		latitudeText.setText(Double.toString(latitude));
		longitudeText.setText(Double.toString(longitude));
		qualityText.setText(getGrade());
		satsTotal.setText(Integer.toString(satellitesTotal));
		satsUsed.setText(Integer.toString(satellitesUsed));
	} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:removeGpsStatusListener, removeUpdates
	} 
	public static void unregisterOnThread(Context context, LocationListener locationCallback, Listener listener) {
		Log.i(TAG,"Unregister for location events");
		LocationManager locationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE);
		if (locationCallback!=null)
			locationManager.removeUpdates(locationCallback);
		if (listener!=null)
			locationManager.removeGpsStatusListener(listener);
	} 
	private static LocationCallback locationCallback;
	static class LocationCallback implements LocationListener, GpsStatus.Listener {
		private Context context;
		LocationCallback(Context context) {
			this.context = context;
		} 
		@Override 
		public void onLocationChanged(Location loc) {
			Log.i(TAG,"Location provider="+loc.getProvider()+", lat="+loc.getLatitude()+", long="+loc.getLongitude()+", bearing="+(loc.hasBearing() ? ""+loc.getBearing() : "NA")+", speed="+(loc.hasSpeed() ? ""+loc.getSpeed() : "NA")+", accuracy="+(loc.hasAccuracy() ? ""+loc.getAccuracy() : "NA")+", alt="+(loc.hasAltitude() ? ""+loc.getAltitude() : "NA"));
			try { 
				JSONStringer js = new JSONStringer();
5
CodeRank
Experience pair programming with AI  Get Codota for Java

Related LocationManager removeGpsStatusListener Questions & Answers:

removeGpsStatusListener Method Overview
Removes a GPS status listener.
See Code Examples for other Android LocationManager Methods: