1# VmAttestationDemoApp
2
3## Overview
4
5The *VmAttestationDemoApp* is an Android application that provides a practical
6demonstration of how to interact with the VM Attestation APIs. This app focuses
7on the payload of the Android app and the payload performs two main tasks:
8requesting attestation and validating the attestation result.
9
10## Building
11
12To build the VmAttestationDemoApp, use the following command:
13
14```
15m VmAttestationDemoApp
16```
17
18## Installing
19
20To install the app on your device, execute the following command:
21
22```
23adb install $ANDROID_PRODUCT_OUT/system/app/VmAttestationDemoApp/VmAttestationDemoApp.apk
24```
25
26## Running
27
28Before running the app, make sure that the device has an internet connection and
29that the remote provisioning host is not empty. You can use the following
30command to check the remote provisioning host:
31
32```
33$ adb shell getprop remote_provisioning.hostname
34remoteprovisioning.googleapis.com
35```
36
37Once you have confirmed the remote provisioning host, you can run the app using
38the following command:
39
40```
41TEST_ROOT=/data/local/tmp/virt && adb shell /apex/com.android.virt/bin/vm run-app \
42  --config-path assets/config.json --debug full \
43  $(adb shell pm path com.android.virt.vm_attestation.demo | cut -c 9-) \
44  $TEST_ROOT/VmAttestationDemoApp.apk.idsig \
45  $TEST_ROOT/instance.vm_attestation.debug.img \
46  --instance-id-file $TEST_ROOT/instance_id \
47  --protected
48```
49
50Please note that remote attestation is only available for protected VMs.
51Therefore, ensure that the VM is launched in protected mode using the
52`--protected` flag.
53
54If everything is set up correctly, you should be able to see the attestation
55result printed out in the VM logs.
56