Guest User

Untitled

a guest
Jul 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. String destination = "London";
  2.  
  3. final Landmark[] landmarks = Locator.geocode(destination.replace('n', ' '), null);
  4. Coordinates endPoint = landmarks[0].getQualifiedCoordinates();
  5. // Get a location provider.
  6. LocationProvider provider = LocationProvider.getInstance(null);
  7. if (provider == null)
  8. {
  9. throw new IllegalStateException("No LocationProvider Available!!");
  10. }
  11. // Try to fetch the current location and get the coordinates of the current location.
  12. Coordinates startPoint = provider.getLocation(-1).getQualifiedCoordinates();
  13.  
  14. double destiinationlatitude = endPoint.getLatitude();
  15. double currentlatitude = startPoint.getLatitude();
  16.  
  17. Criteria criteria = null;
  18. LocationProvider provider = null;
  19. javax.microedition.location.Location location = null;
  20.  
  21. criteria = new Criteria();
  22. criteria.setPreferredPowerConsumption(Criteria.POWER_USAGE_HIGH);
  23. criteria.setHorizontalAccuracy(50);
  24. criteria.setVerticalAccuracy(50);
  25. criteria.setCostAllowed(true);
  26. provider = LocationProvider.getInstance(criteria);
  27. location = provider.getLocation(5);
Add Comment
Please, Sign In to add comment