Projecting ODK Collect onto another screen¶
This guide helps the users to project ODK collect onto a screen. There are various methods available to do this, some of the methods are discussed below:
Vysor is an extension for the Google Chrome browser that connects to an app on your smartphone. This extension enables you to control your phone from your PC or Mac using the mouse/trackpad and keyboard.
Before proceeding further make sure USB Debugging mode is enabled:
Enable USB Debugging Mode on Android¶
- Go to About phone. , choose
- Scroll down and tap Build number seven times.
- Go back to Developer options in the menu. and there you will find
- Scroll down and enable USB debugging mode.
- Confirm the action when prompted.
Windows users should make sure that they have downloaded Universal ADB Drivers.
Follow the instructions given below to use Vysor:
- Make sure you have Google chrome installed, if not download it from here.
- Download Vysor extension.
- Click on Add To Chrome
- Confirm your action by clicking on Add app.
On Windows, You may get an error WebGL is not supported
To fix this, follow the procedures given below:
First, we need to enable hardware acceleration:
- Go to
chrome://settings, scroll down and click on Advanced.
- In the System section, ensure the Use hardware acceleration when available is enabled. You'll need to relaunch Chrome for any changes to take effect. Click on RELAUCH
- Then, we need to enable WebGL, go to
chrome://flags, scroll down and search for WebGL 2.0. From the drop-down list choose Enabled.
Now you can return to Vysor extension and install it again.
- After adding the extension, you would be able to see it in the chrome toolbar, if it is not visible there go to
chrome://appsand you would be able to see there.
- Launch the extension and connect your phone through USB.
- Click on Find Devices, select your device and click on Select.
- After clicking Select, Vysor would be automatically downloaded to your phone, and you will be able to see your phone screen.
- Click on the Collect app and there you go, you have successfully projected your phone screen.
Using Android Studio¶
Android Studio is the official IDE for Android. It provides tools for building apps for every type of Android device. Android Emulator can be used to test your app virtually on any Android device configuration.
Follow the procedures given below to run your app on the emulator:
- Download Android Studio with SDK according to your platform.
- Here is a tutorial on how to set up Android Studio according to different platforms.
- After installing, launch Android Studio and click on Start a new Android Studio project or if you have an existing project click on Open an existing Android Studio project.
- To create a new project follow further steps but if you have an existing project skip to the step 9.
- Choose your project location and fill out the Application name and click on Next.
- Select the Phone and Tablet option and choose your . Click on Next.
- Select an Activity, Empty Activity is preferable. Click on Next.
- In Customize the Activity window, don't change the default options and click on Finish.
- After few minutes, you will be able to see the Android Studio main window, click on icon, alternatively, you can click on Android, from the drop-down menu select AVD Manager. then select
- If you are an existing user list of all virtual devices would appear on the screen, to create a new virtual device, click on + Create Virtual Device…
- In the Select Hardware window, choose a device definition for your virtual device. I have chosen Nexus 5, click on Next.
- Select a system image, I have chosen Lollipop version.Click on Next.
- Enter your AVD Name, choose startup orientation and click on Finish.
14 Now you would be able to see your virtual device in Android Virtual Device Manager. Click on to run your Android emulator.
Please wait for some time as Android emulator takes very long time to start.
- After the emulator is started, you would be able to see the screen of your emulator. :
- Now click on to see the location of Android SDK.
- Open the terminal and move to the platform-tools of the SDK directory.
$ cd platform-tools
- Copy the
platform-toolsfolder. You can download the apk file from here.
- Type the following command to see the list connected devices:
$ adb devices
You should be able to see the emulator along with its port number, e.g emulator-5554, Here 5554 is the port number. If the emulator is not present in the list, restart the emulator.
To install apk file, in the emulator type the following command:
$ adb install collect.apk
If the command is successfully executed, you will find your file in the launcher of your emulator.
Using Command Line¶
You can also run the emulator using command line. Follow the steps given below to start your emulator using the command line:
If SDK installation has been put in another drive or folder instead of in its default location of
$HOME. Make sure you have set the environment variables according to that. In the command line type the following command to set environment variables.
- Open the terminal and move to the
emulatorfolder of the SDK directory.
$ cd emulator
- For the list of available virtual devices, type the following command:
$ emulator -list-avds
If you are not able to locate
emulator.exe file in
SDK folder. Type the following command to know the location of the file:
$ which emulator
> where emulator
- Use emulator to start the emulator. Here avd_name is the name of Android virtual device that you have created.
$ emulator -avd avd_name
You can use sdkmanager command to update, install, and uninstall packages for the Android SDK. This method is not recommended as it is not user-friendly and also takes time.
To create an emulator you need to download system image for a particular API level.
$ sdkmanager --verbose "system-images;android-19;google_apis;x86"
-voption shows errors, warnings and all messages.
system-images;android-19;google_apisspecifies the system image package for the Android virtual device.
android-19specifies the API level. You can choose different API level if you want.
To create and manage Android Virtual device from the command line, you can use avdmanager.
After downloading system image, you can use the following command to create an emulator.
$ avdmanager -v create avd --name testAVD -k "system-images;android-19;google_apis;x86" -g "google_apis"
create avdoption creates a new Android virtual device.
--nameoption is a required option which is used to specify name of the AVD. Here, the name of the AVD is testAVD.
-gspecifies the sys-img tag to use for the AVD.
-kspecifies package path of the system image for the AVD.
You can also use Genymotion as an alternative as it is very fast as compared to custom android emulators. It is also easy to use and configure, and it is available free of cost for personal use.