Android Tutorial

(avery) #1
Android Tutorial 75

Setting the location of the emulator to Yosemite Valley.


Finally, your application requires special permissions to access
location-based functionality. You must
register this permission in your Android
Manifest.xml file. To add location-based
service permissions to your application,
perform the following steps:



  1. Double-click the AndroidManifest.xml file.

  2. Switch to the Permissions tab.

  3. Click the Add button and choose Uses
    Permission.

  4. In the right pane, select
    android.permission.ACCESS_FINE_LOCATI
    ON

  5. Save the file.


Now, if you run My First Android App in
the emulator, your application logs the GPS coordinates you
provided to the emulator as an informational message, viewable in
the LogCat pane of Eclipse. Debugging Your Application on the
Hardware


You mastered running applications in the emulator. Now let’s put
the application on real hardware. First, you must register your
application as Debuggable in your Android Manifest .xml file. To do
this, perform the following steps:



  1. Double-click the AndroidManifest.xml file.

  2. Change to the Application tab.

  3. Set the Debuggable Application Attribute to True.

  4. Save the file.

Free download pdf