Hi Lex:
Sorry for the delayed response. You'll need to programmatically inject
location updates to your test provider.
Here's a code snippet:
/**
* Asynchronously update the mock location provider with given
latitude and
* longitude
*
* @param latitude - update location
* @param longitude - update location
*/
private void sendLocation(final double latitude, final double longitude,
final Object observer) {
Thread locationUpdater = new Thread() {
@Override
public void run() {
Location loc = new Location(PROVIDER_NAME);
loc.setLatitude(latitude);
loc.setLongitude(longitude);
loc.setTime(java.lang.System.currentTimeMillis());
Log.d(LOG_TAG, "Sending update for " + PROVIDER_NAME);
mLocationManager.setTestProviderLocation(PROVIDER_NAME, loc);
}
};
locationUpdater.start();
}
On Wed, Jun 3, 2009 at 9:40 AM, Lex<[email protected]> wrote:
>
> Brett,
>
> how does one use the test provider you mentioned in the bug report?
> I have
>
> locationManager.addTestProvider("mockgps", false, true, false, false,
> false, false, false, 0, 100);
> locationManager.setTestProviderEnabled("mockgps", true);
> locationManager.requestLocationUpdates("mockgps", 0, 0,
> locationListener);
>
> DDMS is showing that "mockgps" is enabled. But how does it work? Is it
> supposed to send any locations or what?
>
> Thanks,
> Lex
>
> On Apr 29, 6:56 am, Brett Chabot <[email protected]> wrote:
>> Sorry, I just tried another machine and can reproduce the issue now.
>> I'll file a bug, thanks for the report.
>>
>> Brett.
>>
>> On Apr 28, 8:58 pm, Brett Chabot <[email protected]> wrote:
>>
>> > Hello:
>>
>> > Hmm, the 'geo fix' command seems to work fine for me. Are you sending
>> > a different value for latitude and longitude on your subsequent geo
>> > fix commands? I noticed that if I send the same latitude/longitude
>> > value twice a location listener only receives a single update.
>>
>> > Brett.
>>
>> > On Apr 28, 6:51 am,AndreasFrey<[email protected]> wrote:
>>
>> > > Hello,
>>
>> > > I have a really simple Android Application using a MyLocationOverlay
>> > > and a LocationManager to determine and show the current position via a
>> > > Toast.
>>
>> > > But the geo fix command i submit via telnet does only work the first
>> > > time i submit it. ALl later tries to update the position do not work.
>>
>> > > Anybody knows this problem?
>> > > Any solutiions
>>
>> > > This is the relevant source code:
>> > > ---------
>> > > ..
>> > > private void initLocationManager() {
>> > > locManager = (LocationManager) getSystemService
>> > > (Context.LOCATION_SERVICE);
>>
>> > > locationListener = new LocationListener() {
>>
>> > > public void onLocationChanged(Location location)
>> > > {
>> > > updatePosition(location);
>> > > }
>> > > public void onProviderDisabled(String arg0) {
>> > > }
>> > > public void onProviderEnabled(String arg0) {
>> > > }
>> > > public void onStatusChanged(String arg0, int
>> > > arg1, Bundle arg2) {
>> > > }
>> > > };
>>
>> > >
>> > > locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
>> > > 0,
>> > > locationListener);
>> > > }
>>
>> > > private void updatePosition(Location location) {
>> > > Toast t = Toast.makeText(
>> > > this,
>> > > getString(R.string.msgPosition,
>> > > location.getLatitude(),
>> > > location.getLongitude()),
>> > > Toast.LENGTH_SHORT);
>> > > t.show();
>>
>> > > theMap.getController().animateTo(
>> > > new GeoPoint(
>> > >
>> > > (int)(location.getLatitude()*1E6),
>> > >
>> > > (int)(location.getLongitude()*1E6)));
>> > > theMap.postInvalidate();
>>
>> > > }
>> > > ----------
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---