Database Reference
In-Depth Information
The built application needs to be deployed either to a virtual device or a
real phone. A virtual device is convenient for testing and is straightforward
to set up. Selecting Window Android Virtual Device Manager brings up
a dialog listing configured devices and controls to edit them and create
new ones. You can find instructions on managing virtual devices at
http://developer.android.com/tools/devices/ .
The sample application targets SDK version 14 as the minimum supported
version, so the main setting to pay attention to when creating the device is to
select a target with a SDK version equal to or higher than 14. For reference,
the app was developed using a Nexus 4 virtual device with Android 4.2.2
(API version 17). It is also fairly simple to test the application on a real
device.
Detailed
instructions
are
available
at
http://developer.android.com/tools/device.html .
These online resources are part of the Android developer website, which is
a useful destination if you are interested in experimenting with the sample
mobile client. With the SDK set up you can start exploring the source code.
Monitoring Service
The source code for the project is spread across four Java source files and
a handful of XML files that contain UI resources. The core part of the
application is a background service that periodically wakes up, captures the
state of the phone, and ships it to the cloud component of the application by
performing an HTTP POST operation. This functionality is implemented in
the files:
MonitoringService.java
CommandRunner.java
The rest of the files implement the user interface for the application and
handle the registration of the device. In the context of BigQuery and
analytics, this background service, shown in Listing 8.1 , is the most
interesting part of the application and demonstrates a design you may end
up reusing in your clients.
Listing 8.1 : MonitoringService.java
public class MonitoringService extends IntentService {
// ELIDED
 
 
Search WWH ::




Custom Search