Android Open Source - LocBox Location Receiver






From Project

Back to project page LocBox.

License

The source code is released under:

MIT License

If you think the Android project LocBox listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.codebrane.locbox;
//w  ww .  j  a  va  2 s.c  o  m
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationManager;
import android.util.Log;

public class LocationReceiver extends BroadcastReceiver {
  private static final String TAG = "LocationReceiver";

  @Override
  public void onReceive(Context context, Intent intent) {
    Location location = (Location)intent.getParcelableExtra(LocationManager.KEY_LOCATION_CHANGED);
    if (location != null) {
      onLocationReceived(context, location);
      return;
    }
    
    // If you get here, something else has happened
    if (intent.hasExtra(LocationManager.KEY_PROVIDER_ENABLED)) {
      boolean enabled = intent.getBooleanExtra(LocationManager.KEY_PROVIDER_ENABLED, false);
      onProviderEnabledChanged(enabled);
    }
  }
  
  protected void onLocationReceived(Context context, Location location) {
    Log.d(TAG, this + " p=" + location.getProvider() + " lat=" + location.getLatitude() + " lon=" + location.getLongitude());
//    location.getProvider();
//    location.getLatitude();
//    location.getLongitude();
  }
  
  protected void onProviderEnabledChanged(boolean enabled) {
  }

}




Java Source Code List

com.codebrane.locbox.LocationReceiver.java
com.codebrane.locbox.LocboxActivity.java
com.codebrane.locbox.LocboxManager.java
com.codebrane.locbox.SingleFragmentActivity.java
com.codebrane.locbox.controller.LocboxFragment.java
com.codebrane.locbox.model.CBLocation.java
com.codebrane.locbox.model.Walk.java