views:

10

answers:

0

Hi

I am using the following code for finding the location, this code is working fine in simulator but when i am deploying it in device it is not working.. can any one please help me out.

  public class LocationFinder extends Thread {
    public LocationFinder() {
        }

    public void run(){ 
        Criteria criteria = new Criteria();
        criteria.setVerticalAccuracy(5000);
        criteria.setHorizontalAccuracy(5000);
        criteria.setCostAllowed(true);
        criteria.setPreferredPowerConsumption(
                Criteria.POWER_USAGE_HIGH);
        try {
        LocationProvider provider =
        LocationProvider.getInstance(criteria);
        Location location = provider.getLocation(-1);
        QualifiedCoordinates qualifiedCoordinates =
        location.getQualifiedCoordinates();
        lat = qualifiedCoordinates.getLongitude();
        log = qualifiedCoordinates.getLatitude();
        } catch (LocationException e) {
        e.getMessage();
        } catch (InterruptedException e) {
            Dialog.alert(e.getMessage());
        }