GPS emulation

by olivier » Wed, 29 Apr 2009 01:07:49 GMT


Sponsored Links
 Hi all,

I am currently trying to simulate GPS fixs with android emulator, but
I encountered some problems. I can run the app, clic on the send
button in the emulator control, but, only the first click provides a
position. I am running an ubuntu jaunty, eclipse and SDK 1.5, on a
french system with the locale EN_US
Here is my code :

private class MyLocationListener implements LocationListener
            {
                @Override
                public void onLocationChanged(Location loc) {
                    if (loc != null) {
                        String s = "";
                        s += loc.getLatitude();
                        s += "   ";
                        s += loc.getLongitude();
                        Toast.makeText(getBaseContext(),
                            "Location changed : Lat: " + loc.getLatitude() +
                            " Lng: " + loc.getLongitude(),
                            Toast.LENGTH_SHORT).show();
                        Log.i("GPS", s);
                    }
                    else {
                        Log.i("Gps","loc_null");
                    }
                }

                @Override
                public void onProviderDisabled(String provider) {
                    // TODO Auto-generated method stub
                        Log.i("Gps","onProviderDisabled");
                }

                @Override
                public void onProviderEnabled(String provider) {
                    // TODO Auto-generated method stub
                        Log.i("Gps","onProviderEnabled");
                }

                @Override
                public void onStatusChanged(String provider, int status,
                    Bundle extras) {
                    // TODO Auto-generated method stub
                        Log.i("Gps","onStatusChanged : " + provider);
                }
            }

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       //---use the LocationManager class to obtain GPS locations---
        lm = (LocationManager) getSystemService
(Context.LOCATION_SERVICE);

        locationListener = new MyLocationListener();

        lm.requestLocationUpdates(
            LocationManager.GPS_PROVIDER,
            0,
            0,
            locationListener);

    }

Can you tell me what I am doing wrong ?

Regards,

Olivier

--~--~---------~--~----~------------~-------~--~----~



GPS emulation

by ellipsoidmob...@googlemail.com » Wed, 29 Apr 2009 17:16:30 GMT


 Are you changing the location set in the emulator before each click,
or are you just sending the same location repeatedly?

I suspect (but don't know for sure) that even with distance & time set
to 0 in requestLocationUpdates, an update won't be generated if the
new location is identical to the old location.
--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


GPS emulation

by Andreas Frey » Wed, 29 Apr 2009 17:28:38 GMT


 Hi,

i had a similar problem using the geo fix command - only the first
transmission of a newlocation worked.
Look @ here:



GPS emulation

by Olivier Tournaire » Wed, 29 Apr 2009 18:03:15 GMT


 i,

Hi,


I saw this post, same day as mine ;-)

I "solved" the problem with a dirty hack:


@Override
public void onLocationChanged(Location loc) {
if (loc != null) {
String s = "";
s += loc.getLatitude();
s += " ";
s += loc.getLongitude();
Log.i("GPS", s);
}
else {
Log.i("Gps","loc_null");
}
* lm.removeUpdates(locationListener);
lm.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
xxx,
xxx
locationListener); *
}

Crappy isn't it ?

Regards,

Olivier



--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. What's happening to my posts here? Is someone deleting them?

Hello,

I have posted 8 posts to this group. But I can't find any of them.

My profile shows that I have posted 8 + this one, but only one of them
is listed. I posted a question about a soft keyboard on September 15,
and then I saw it posted. But now it's now longer there.

Is it the policy of this group to remove the posts for which Android
cannot give an answer?

It's really disheartening to come here and post a question and not
only get no answer, but then get your post censored!  Can someone
manning the booth here give a reasonable answer to this?

-- 

2. SendLog

Hi all, I discovered the useful sendlog app. I was just wondering: is
there a way to open sendlog generated files with ddms in order to take
advantage of nice formatting and filtering??

Thanks,

Federico

-- 

3. android emulator is slow on vmware

4. IntentService: Sending Message to a handler on dead thread

5. Android webview Searching Issue

6. Best method to save a array in Bundle?

7. Why aren't the 2D graphics API & UI toolkit hardware accelerated?