Testing the AirBop Client Sample on an Emulator
Creating a Compatible Virtual Device
Google Cloud Messaging (GCM) is only supported on Android versions 2.2 and above. In addition, you need to select an Android Virtual Device (AVD) that contains the Google Cloud Messaging libraries. These are indicated by the Virtual Device "Target" values prefixed with "Google APIs (Google Inc.)", followed by the API level that represents the Android version.
The minimum "Target" for the Android Virtual Device is "Google APIs (Google Inc.) - API Level 8". In the list you'll also find similar targets for newer Android versions such as "Google APIs (Google Inc.) - API Level 15" as shown below.
Note: If you're testing a pre-3.0 emulator device you'll also need to setup a Google account on the emulator since GCM uses an existing connection for Google services. To do this, launch the emulator, press the "Menu" button and select "Settings". In the settings, select "Accounts & sync" and press the "Add Account" button to add a Google account.
Testing Optional Client Location Values
AirBop allows you to optionally collect location information from the client app to pass to the AirBop servers for more accurate location targeting, beyond the default IP lookup. The AirBop Client Sample code contains a boolean flag for enabling the client location query, and requires a small change to the app's manifest before it's enabled. To enable that feature in the client sample, please see the "USE_LOCATION" variable definition in the Optional Values For Replacement section of the readme file.
There are a couple steps you need to perform in order for the client location query to succeed on a Virtual Device. Once your virtual device has started, make sure that the "GPS satellites" feature is enabled in the virtual device's Android settings. This setting can be found in the "Location services" area of the device's settings as shown below:
Location Services in Android Settings
GPS Satellites Setting
If you run AirBop's client sample app on the virtual device you'll see that it's trying to collect the device's location setting, as seen below:
The next step is to provide the device with a spoofed location using the "Emulator Control" tab of the debugging tool called the Dalvik Debug Monitor Server (DDMS). DDMS is integrated into Eclipse and also shipped with the SDK. With your virtual device connected, you can access this area in Eclipse from Window > Open Perspective > Other... > DDMS.
After switching to the DDMS perspective, you'll find the tab labelled "Emulator Control" with a section within it labeled "Location Controls" as shown below. This allows you to send the device a latitude and longitude coordinate.
After sending the location coordinate to the device you'll see that the device can now be registered with the location as shown below:
Sending coordinates can also be performed from the command line as discussed in the Android emulator documentation.