Code example for LocationManager

Methods: removeGpsStatusListenerremoveUpdates

0
	 
	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();        	        	    			
    		} 
    	} 
    	catch (SecurityException e)
    	{ 
        	Toast.makeText(mContext, "No permission to use GPS", Toast.LENGTH_SHORT).show();        	        	    			    		
    	} 
    } 
     
    private void unregister_GPS() 
    { 
    	mLocationManager.removeGpsStatusListener(this);
 //   	mLocationManager.removeNmeaListener(this); 
    } 
 
    public void onStatusChanged(String provider, int status, Bundle extras)
    {