Quantcast
Channel: HTML5
Viewing all articles
Browse latest Browse all 663

Test in Emulator

$
0
0

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* 2.x 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.

If your app uses the Apache Cordova APIs, the 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

  1. Click the Devices panel to expand it. Choose a virtual Device to be tested. For example, choose a type of smart phone:


    Virtual device under test in Device Emulator

  2. If needed, use scrollbars within the virtual device to view the Intel logo and buttons on the virtual device.

  3. Click the Beep button and listen for an audio beep.

  4. Click the Vibrate button and watch the virtual device vibrate.

  5. Click the Play Sound button and listen for a few musical notes from a flute.

  6. 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.

  7. After you modify index.html to remove comments from lines 32-34, skip to step 11 to retest only the new features.

  8. In the Devices panel, choose a different Orientation. Retest starting at step 2 above.

  9. In the Devices panel, choose a larger Device, such as a tablet. Retest starting at step 2 above.

  10. 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.

  11. After you modify index.html to remove comments from lines 32-34, retest these new features:

    • Open the Accelerometer panel. 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 panel 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 panels (or choose a large enough device in the Device panel) 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 panel 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 panel to simulate your app's geographical location capabilities. This panel 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:

  1. Open the PushMobi Service panel.

  2. After referencing the intelxdk.js library, the app needs do one of the following:

    1. For a new user, call the PushMobi server using the appMobi.notification.addPushUser service to log in.

    2. For an existing user, call the PushMobi server using the appMobi.notification.checkPushUser to log in.

  3. Once the login is complete, this PushMobi Service panel 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.

  4. Type the message to be displayed.

  5. Click Send.

  6. To receive messages, your application must check for available messages using the appropriate service. For example, the appMobi.notification.getNotificationList and appMobi.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:

  1. Open the Live Update Service panel.

  2. 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).

  3. Type a message to be entered into a change log.

  4. Click Send.

English(英语)

Viewing all articles
Browse latest Browse all 663


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>