Hi. Here i want show you how to use Android GPS quickly. This is simple, may be not perfect example how to get current location by GPS.
To use GPS in your application first of all you must specify the uses-permission in Android manifest file:
<manifest> ... <uses -permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses> ... </manifest>
If you don’t set this permission the application can’t get access to location service.
To use this application with android emulator you must mock location data. To do this using Eclipse you must:
- Select Window > Show View > Other > Emulator Control
- In Emulator Control panel enter the GPS coordinates under Location Controls and press Send
This operation you must do every time then you Run application.
Below you can see the application activity (HelloAndroidGpsActivity.java) source. Below you can download the source code of this Android project.
For more information about Android GPS Usage look HERE
Read the rest of this entry »