Hi,
I have this strange problem with GPS.Inside the emulator,it displays
the initial value but it does not update the value.This is what I am
doing.I run my application and then go to DDMS,load the KML file and
then click play.I am using android sdk:1.5_r3.This is the code I am
using:
package com.cameraExample;

import java.util.List;
import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import android.widget.Toast;
public class GPStest2 extends Activity
{
    private LocationManager lm;
    private MyLocationListener listener;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        TextView txtView = new TextView(this);
        txtView.setText("Welcome Sharmila :)");
        setContentView(txtView);


        listener = new MyLocationListener(txtView);
        lm = (LocationManager)
            getSystemService(Context.LOCATION_SERVICE);
        lm.requestLocationUpdates(
            LocationManager.GPS_PROVIDER,
            0,
            0,
            listener);
    }

    public void onDestroy()
    {
     lm.removeUpdates(listener);
     listener.stop();
     Log.i("GPS", "Stopping the GPS Service");
     super.onDestroy();

    }

    private class MyLocationListener implements LocationListener
    {
     private TextView v;
     private boolean stop = false;
     public MyLocationListener(TextView v)
     {
      this.v = v;
     }
        @Override
        public void onLocationChanged(Location loc) {
            if (loc != null && !stop) {
             v.setText("Your new Location : \nLongitude: "
+loc.getLongitude() + "\nLatitude: "+loc.getLatitude());
            }
        }
        @Override
        public void onProviderDisabled(String provider) {
         Toast.makeText(GPStest2.this,
                    "Disabling the Updates",Toast.LENGTH_SHORT).show
();
        }
        @Override
        public void onProviderEnabled(String provider) {
            // TODO Auto-generated method stub
        }
        @Override
        public void onStatusChanged(String provider, int status,
            Bundle extras) {
            // TODO Auto-generated method stub
        }
        public void stop()
        {
         stop = true;
        }
    }

}
 The code works fine for Linux machine but does not work for windows.
I also tried to send telnet commands using geofix.The same problem
occurs!I am totally lost!
Can someone please help me out?
Thanks,
Sharmila
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to