Criteria myCriteria = new Criteria(); myCriteria.setAccuracy(Criteria.ACCURACY_HIGH); myCriteria.setPowerRequirement(Criteria.POWER_LOW); // let Android select the right location provider for you String myProvider = locationManager.getBestProvider(myCriteria, true); // finally require updates at -at least- the desired rate long minTimeMillis = 600000; // 600,000 milliseconds make 10 minutes locationManager.requestLocationUpdates(myProvider,minTimeMillis,0,locationListener);
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); // Add this line map.setMyLocationEnabled(true); locManager = (LocationManager)getSystemService(LOCATION_SERVICE); providersList = locManager.getAllProviders(); provider =locManager.getProvider(providersList.get(0)); precision = provider.getAccuracy(); req = new Criteria(); req.setAccuracy(Criteria.ACCURACY_FINE); inside = false; //map.getUiSettings().setMyLocationButtonEnabled(true); buildPolygon(); drawPolygon(); startLocalization(); }
int parentId = 100; int level = 5; Criteria c = new Criteria().andOperator(Criteria.where("treePath").is(parentId), Criteria.where("treePath").size(level)); System.out.println(c.getCriteriaObject());
Button gpsButton = (Button)this.findViewById(R.id.buttonGPSLocation); gpsButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // Start loction service LocationManager locationManager = (LocationManager)[OUTERCLASS].this.getSystemService(Context.LOCATION_SERVICE); Criteria locationCritera = new Criteria(); locationCritera.setAccuracy(Criteria.ACCURACY_COARSE); locationCritera.setAltitudeRequired(false); locationCritera.setBearingRequired(false); locationCritera.setCostAllowed(true); locationCritera.setPowerRequirement(Criteria.NO_REQUIREMENT); String providerName = locationManager.getBestProvider(locationCritera, true); if (providerName != null && locationManager.isProviderEnabled(providerName)) { // Provider is enabled locationManager.requestLocationUpdates(providerName, 20000, 100, [OUTERCLASS].this.locationListener); } else { // Provider not enabled, prompt user to enable it Toast.makeText([OUTERCLASS].this, R.string.please_turn_on_gps, Toast.LENGTH_LONG).show(); Intent myIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); [OUTERCLASS].this.startActivity(myIntent); } } });
//All your normal criteria setup Criteria criteria = new Criteria(); //Use FINE or COARSE (or NO_REQUIREMENT) here criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setPowerRequirement(Criteria.POWER_LOW); criteria.setAltitudeRequired(true); criteria.setSpeedRequired(true); criteria.setCostAllowed(true); criteria.setBearingRequired(true); //API level 9 and up criteria.setHorizontalAccuracy(Criteria.ACCURACY_HIGH); criteria.setVerticalAccuracy(Criteria.ACCURACY_HIGH); criteria.setBearingAccuracy(Criteria.ACCURACY_LOW); criteria.setSpeedAccuracy(Criteria.ACCURACY_MEDIUM);
Criteria c = new Criteria(); c.setAccuracy(Criteria.ACCURACY_COARSE);
Criteria criteria = new Criteria(); criteria.orOperator(Criteria.where("A").is(10),Criteria.where("B").is(20)); Query query = new Query(criteria); mongoOps.find(query, <Yourclass>.class, "collectionName");
LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE); Criteria criteria = new Criteria(); String provider = service.getBestProvider(criteria, false); Location location = service.getLastKnownLocation(provider); LatLng userLocation = new LatLng(location.getLatitude(),location.getLongitude());
LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setAltitudeRequired(false); criteria.setBearingRequired(false); criteria.setCostAllowed(true); String strLocationProvider = lm.getBestProvider(criteria, true);
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); Location location = locationManager.getLastKnownLocation(locationManager.getBestProvider(criteria, false)); if (location != null) { map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()), 13)); CameraPosition cameraPosition = new CameraPosition.Builder() .target(new LatLng(location.getLatitude(), location.getLongitude())) // Sets the center of the map to location user .zoom(17) // Sets the zoom .bearing(90) // Sets the orientation of the camera to east .tilt(40) // Sets the tilt of the camera to 30 degrees .build(); // Creates a CameraPosition from the builder map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); }
private final Criteria criteria = new Criteria(); private String bestAvailableProvider; criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setPowerRequirement(Criteria.POWER_LOW); criteria.setAltitudeRequired(true); criteria.setBearingRequired(true); criteria.setSpeedRequired(true); criteria.setCostAllowed(true);
private void _getLocation() { // Get the location manager LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); Criteria criteria = new Criteria(); String bestProvider = locationManager.getBestProvider(criteria, false); Location location = locationManager.getLastKnownLocation(bestProvider); try { lat = location.getLatitude(); lon = location.getLongitude(); } catch (NullPointerException e) { lat = -1.0; lon = -1.0; } }
Criteria criteria = new Criteria();
LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); String provider = locationManager.getBestProvider(new Criteria(), true); Location locations = locationManager.getLastKnownLocation(provider); List<String> providerList = locationManager.getAllProviders(); if(null!=locations && null!=providerList && providerList.size()>0){ double longitude = locations.getLongitude(); double latitude = locations.getLatitude(); Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault()); try { List<Address> listAddresses = geocoder.getFromLocation(latitude, longitude, 1); if(null!=listAddresses&&listAddresses.size()>0){ String _Location = listAddresses.get(0).getAddressLine(0); } } catch (IOException e) { e.printStackTrace(); } }
window.criteria = new Criteria() window.criteria.set({'tags', []}) //you can use new Array() if you want window.criteria.get('tags').push(5) window.criteria = new Criteria() console.log(window.criteria.get('tags')) //should be undefined window.criteria.set({'tags', []})
Criteria criteria = new Criteria(); provider = locationManager.getBestProvider(criteria, false); Location location = locationManager.getLastKnownLocation(provider);
boolean isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (isNetworkEnabled) { Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_COARSE); locationManager.requestSingleUpdate(criteria, new LocationListener() { boolean isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); if (isGPSEnabled) { Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); locationManager.requestSingleUpdate(criteria, new LocationListener() {
Criteria criteria = new Criteria();
private void _getLocation() { // Get the location manager LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); Criteria criteria = new Criteria(); String bestProvider = locationManager.getBestProvider(criteria, false); Location location = locationManager.getLastKnownLocation(bestProvider); LocationListener loc_listener = new LocationListener() { public void onLocationChanged(Location l) {} public void onProviderEnabled(String p) {} public void onProviderDisabled(String p) {} public void onStatusChanged(String p, int status, Bundle extras) {} }; locationManager .requestLocationUpdates(bestProvider, 0, 0, loc_listener); location = locationManager.getLastKnownLocation(bestProvider); try { lat = location.getLatitude(); lon = location.getLongitude(); } catch (NullPointerException e) { lat = -1.0; lon = -1.0; } }
Criteria criteria = new Criteria();