After you have configured the Device Emulator environment, you can test the various features provided by your app's APIs, including on-board device sensors, push messages, app update, and firing events.
The Device Emulator will support the use of Apache Cordova* core APIs and Intel XDK library APIs, including App Framework and the App Games Interfaces (AGI).
Note
The Device Emulator assumes the entry point for the current project is index.html in the top-most directory.
The Device Emulator does not support use of mp3 audio files.
If you recently modified your sources using the DEVELOP tab, click the button to update the virtual device shown in the EMULATE tab. The first time you do this, consider choosing the option to have the app's modified files automatically reload when you click EMULATE. At any time, you can view or change the auto- or manual-load settings by clicking the
button on the left side of the toolbar.
If your app uses the Apache Cordova APIs, the config.xml or intelxdk.config.xml file provides a helpful list of the on-board sensors your app uses; this list may be helpful during testing.
For this Tutorial: Do the Following to Test the Device
Click the Devices palette to expand it. Choose a virtual Device to be tested. For example, choose a type of smart phone:
If needed, use scrollbars within the virtual device to view the Intel logo and buttons on the virtual device.
Click the Beep button and listen for an audio beep.
Click the Vibrate button and watch the virtual device vibrate.
Click the Play Sound button and listen for a few musical notes from a flute.
Click the Play Dead button and see that the screen has gone dark. Click the virtual device's screen to display the app's output again. This app uses the App Framework.
After you modify index.html to remove comments from lines 32-34, skip to step 11 to retest only the new features.
In the Devices palette, choose a different Orientation. Retest starting at step 2 above.
In the Devices palette, choose a larger Device, such as a tablet. Retest starting at step 2 above.
In the next topic, you will uncomment lines 32-34 in index.html to reveal new features that should be re-tested later. If you have not yet uncommented these lines, skip the following steps for now.
After you modify index.html to remove comments from lines 32-34, retest these new features:
Open the Accelerometer palette. Click the
(Shake) button. Listen for audio beeps while the virtual device shakes.
Optionally using the DESIGN view, you can add a Take Picture button by locating the GO button under Controls > Forms and drag it below other buttons on the device. Rename its Label from Button to Take Picture. To simulate the camera taking a picture, switch to the CODE view in index.html file's line 117 to add the
ontouchstart
attribute to use a function in camera.js). To close the picture, click the Cancel button above the picture.Use the Devices palette to select a larger Device or a different Orientation. Consider retesting some items.
You have tested the primary features of this demo app. In this case, we uncommented some code instead of modifying the app's code as a result of testing.
Scrolling in the Device Emulator
If you open enough palettes (or choose a large enough device in the Device palette) the Device Emulator UI may become larger than your Intel XDK window. In that case the entire Device Emulator window becomes scrollable. You can scroll using the mouse wheel or the arrow keys. There is also a vertical scrollbar on the right side.
If the app emulated by the virtual device displays a UI that is larger than the Intel XDK window, then the window in the virtual device also becomes scrollable. To scroll within the device window:
Click the device window to give it focus.
To scroll vertically, either use the mouse wheel or the up arrow or down arrow keys.
To scroll horizontally, use the left arrow or right arrow keys.
If your host computer has a touch screen, you can also use touch-based scrolling, both for the device window and the entire Device Emulator UI.
Accelerometer
Use this palette to simulate device rotation and gyroscopic movement by dragging the small device using the mouse pointer. As you drag it, the displayed accelerometer values change:
Rotation on the x-, y-, and z-axis.
Gyroscopic values alpha, beta, and gamma.
Apps that use accelerometer APIs can show the changes to the accelerometer values visually, such as the RollingCan demo (Projects tab > Start a New Project > Work with a demo > RollingCan).
Geolocation
Use this palette to simulate your app's geographical location capabilities. This palette provides a geo location map, a slider to zoom in or out, and other capabilities.
Test Push Messages
You can test push messages within the Device Emulator. This action does not push messages to actual users. To do this:
Open the AppMobi PushMobi Service palette.
After referencing the intelxdk.js library, the app needs do one of the following:
For a new user, call the PushMobi server using the
appMobi.notification.addPushUser
service to log in.For an existing user, call the PushMobi server using the
appMobi.notification.checkPushUser
to log in.
Once the login is complete, this PushMobi Service palette lets you enter the message to test-push to the user. This login indicates to the PushMobi server that this app is running under emulation.
Type the message to be displayed.
Click Send.
To receive messages, your application must check for available messages using the appropriate service. For example, the
appMobi.notification.getNotificationList
andappMobi.notification.getNotificationData
services. For more information, see the documentation for PushMobi web services, such as http://docs.appmobi.com/index.php/push-messages.
Test Live Update
You can test you app's ability to send a Update notification to users that a new version of your app is available. You can choose to emulate the Live Update now, after a reboot occurs, or to notify the user or app. To do this:
Open the AppMobi Live Update Service palette.
Select how the test message will be delivered. Messages can be delivered automatically or by notifying the user of the app that a message needs to be viewed (see the appMobi service documentation).
Type a message to be entered into a change log.
Click Send.