Книга: Beginning Android
The Key to It All
The Key to It All
If you actually download the source code for the book, compile the NooYawk project, install it in your emulator, and run it, you will probably see a screen with a grid and a couple of pushpins, but no actual maps.
That’s because the API key in the source code is invalid for your development machine. Instead, you will need to generate your own API key(s) for use with your application.
Full instructions for generating API keys, for development and production use, can be found on the Android Web site.[33] In the interest of brevity, let’s focus on the narrow case of getting NooYawk running in your emulator. Doing this requires the following steps:
1. Visit the API key signup page and review the terms of service.
2. Re-read those terms of service and make really, really sure you want to agree to them.
3. Find the MD5 digest of the certificate used for signing your debug-mode applications (described in detail in the following).
4. On the API key signup page, paste in that MD5 signature and submit the form.
5. On the resulting page, copy the API key and paste it as the value of apiKey
in your MapView
-using layout.
The trickiest part is finding the MD5 signature of the certificate used for signing your debug-mode applications… and much of the complexity is merely in making sense of the concept.
All Android applications are signed using a digital signature generated from a certificate. You are automatically given a debug certificate when you set up the SDK, and there is a separate process for creating a self-signed certificate for use in your production applications. This signature process involves the use of the Java keytool
and jarsigner
utilities. For the purposes of getting your API key, you only need to worry about keytool
.
To get your MD5 digest of your debug certificate, if you are on OS X or Linux, use the following command:
keytool -list -alias androiddebugkey -keystore ~/.android/debug.keystore -storepass
android -keypass android
On other development platforms, you will need to replace the value of the -keystore
switch with the location for your platform and user account:
• Windows XP: C:Documents and Settings<user>Local SettingsApplication DataAndroiddebug.keystore
• Windows Vista: C:Users<user>AppDataLocalAndroiddebug.keystore
(where <user>
is your account name)
The second line of the output contains your MD5 digest, as a series of pairs of hex digits separated by colons.
- Drawbacks with restore
- Use and Edit Files in the
- About the Author
- Starting the Install
- Playing Windows Games with Cedega
- Using DNS Security Extensions
- Measuring Key Buffer Usage
- Using Fedora's kickstart Installation Method
- 10.6.1. Security Model
- Configuring the mgetty Daemon
- The ssh daemon
- 4.4.4 The Dispatcher