LocationManager addGpsStatusListener - 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 addGpsStatusListener method.

This code example shows how to use the following methods:addGpsStatusListener, getLastKnownLocation, removeUpdates, requestLocationUpdates
This code example shows how to use the following methods:addGpsStatusListener, addNmeaListener, requestLocationUpdates
	@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);
		 
	} 
 
	//GPS Listener implementations 
	public void onGpsStatusChanged(int arg0) {
		//Print out the status 
		if (arg0==GpsStatus.GPS_EVENT_FIRST_FIX)
			Stat.setText("GPS Status :GPS_EVENT_FIRST_FIX");
		else if (arg0==GpsStatus.GPS_EVENT_SATELLITE_STATUS)
			Stat.setText("GPS Status :GPS_EVENT_SATELLITE_STATUS");
		else if (arg0==GpsStatus.GPS_EVENT_STARTED)
			Stat.setText("GPS Status :GPS_EVENT_STARTED");
6
CodeRank
This code example shows how to use the following methods:addGpsStatusListener, getLastKnownLocation, isProviderEnabled, requestLocationUpdates
 
	@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");
	} 
 
	private void updateEnabled(boolean providerEnabled) {
		TextView enabledTextView = (TextView)findViewById(R.id.gps_enabled_text_view);
		enabledTextView.setText(providerEnabled ? "Yes" : "No");
	} 
 
	private void updateLocation(Location loc) {
		TextView tv;
6
CodeRank
This code example shows how to use the following methods:addGpsStatusListener, isProviderEnabled, requestLocationUpdates
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
This code example shows how to use the following methods:addGpsStatusListener, getBestProvider, getLastKnownLocation, isProviderEnabled, requestLocationUpdates
 
	}; 
 
	private void initLocation() { 
		ct = new Criteria();
		lm.addGpsStatusListener(gpsListener);
		if (lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
			// ��ȡ����GPS��λ�� 
			ct.setAccuracy(Criteria.ACCURACY_FINE);// �߾���
			ct.setAltitudeRequired(true);// ��ʾ����
			ct.setBearingRequired(true);// ��ʾ����
			ct.setSpeedRequired(true);// ��ʾ�ٶ�
			ct.setCostAllowed(false);// ���������
			ct.setPowerRequirement(Criteria.POWER_LOW);// �͹���
			provider = lm.getBestProvider(ct, true);
			loc = lm.getLastKnownLocation(provider);
			// λ�ñ仯���� 
			Log.i("my", "gps_location ");
			lm.requestLocationUpdates(provider, 0, 10, locationListener);
		} else if (lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {

6
CodeRank
This code example shows how to use the following methods:addGpsStatusListener, getBestProvider, getLastKnownLocation
6
CodeRank
This code example shows how to use the following methods:addGpsStatusListener, addNmeaListener, requestLocationUpdates
This code example shows how to use the following methods:addGpsStatusListener, addNmeaListener, requestLocationUpdates
        instance = System.currentTimeMillis();
        accelerometerLog = new AccelerometerLog();
        magneticLog = new MagneticLog();
        orientationLog = new OrientationLog();
        locationLog = new LocationLog(context);
        gpsStatusListener = new GpsStatusLog(locMan);
        gpsNmeaListener = new NmeaLog();
        telephonyLog = new TelephonyLog();
        batteryLog = new BatteryLog();
        logcatLog = new LogcatLog();
    } 
 
    private void closeLogs() { 
        accelerometerLog.close();
        magneticLog.close();
        orientationLog.close();
        locationLog.close();
        gpsStatusListener.close();
        gpsNmeaListener.close();
        telephonyLog.close();

5
CodeRank
This code example shows how to use the following methods:addGpsStatusListener, isProviderEnabled, requestLocationUpdates
		unregisterListeners(); 
	} 
 	 		 
    private void registerListeners() { 
    	if(locationManager != null) {
			if( !locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) )
				Log.w(TAG, "GPS is disabled.");	
			try { 
				locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 100, 0, surfaceView);
				locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 100, 0, surfaceView);
			} catch (Exception e){
				Log.w(TAG, "Failed to request GPS locations: " + e.toString() );
			} 
    	} 
    	 
		if( !locationManager.addGpsStatusListener(surfaceView) )
			Log.w(TAG, "Failed to listen GPS status!");
 
    	if(sensorManager != null) {
			Sensor accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
			if(accelerometer != null)
5
CodeRank

Related LocationManager addGpsStatusListener Questions & Answers:

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