Emulation Notes

if you run the LocationTest example on a real device, it will show your current position as you walk around. On the emulator, it uses a fake GPS provider that always returns the same position unless you change it. Let's do that now.

in Eclipse you can change your simulated location using the Emulator Control view (Window > Show View > Other... > Android > Emulator control). Scroll down to the bottom, and you'll find a place to enter the longitude and latitude manually. When you click the Send button, Eclipse will send the new position to the emulated device, and you'll see it displayed in any programs that are watching for it.

You can also run the Dalvik Debug Monitor Service (DDMS) program outside of Eclipse and send fake position changes in that way. In addition to manual, position-at-a-time updates, you can use a recorded path read from an external file. See the DDMS documentation for more information.3

With Android location providers, you can find out where you are in a broad, global sense. If you want more local information such as tilt and temperature, you have to use a different API. That's the subject of the next section.

0 0

Post a comment