Home > Articles > Mobile Application Development & Programming

  • Print
  • + Share This
This chapter is from the book

Using the Emulator

As an alternative to integrating an actual smartphone into the AI IDE, you can test and simulate the look and behavior of an app you are developing by using a virtual version of a smartphone on the computer. You can access this emulator directly in AI with the menu button labeled “New emulator.” An existing USB connection and any device-specific drivers are then no longer required. Be aware that the emulator offers only basic functions; telephony, SMS, GPS and other sensors can be simulated only with great difficulty, if at all. In this respect, the emulator is a suitable replacement for the smartphone only for certain aspects of testing and running apps.

To integrate the emulator into the AI IDE just like a smartphone, you first need to launch it by clicking the New Emulator button in the AI Blocks Editor. This opens a window with information on the emulator, asking you to be patient while it is starting (see Figure 2.31). In fact, when you first start the emulator, it can take a minute or longer before the emulator is properly launched with the Android operating system on your computer and becomes available for use.

Figure 2.31.

Figure 2.31. Window when starting the emulator via the New Emulator button

After a certain loading time, the emulator window opens with an identifier such as “5554:<build>” and the emulator starts to “boot” the Android operating system, as would happen when you first start your smartphone. In Figure 2.32 (far left), you can see the typical Android logo before the start image with screen lock and the display label “Android” appears (second from the left). Now you can operate the emulator in much the same way as you operate your smartphone, albeit by using the mouse pointer instead of your finger on the emulator screen. Drag the lock icon to the right with the mouse to unlock the emulator screen (second from the right). You can now access the start screen with the usual operating elements (far right).

Figure 2.32.

Figure 2.32. Starting and operating the emulator

Below the emulator’s screen area, you can see the usual user elements that are present as physical buttons on most current Android devices. You click on these items with the mouse to go to the home screen or the menu, go back, search, move through menu items, adjust the volume, and so on. Feel free to experiment with the functions and apps already installed on the emulator—you will find almost no difference between them and your own smartphone, assuming it also has an unaltered Android interface.

To integrate the emulator into the AI development environment so you can test your apps, you proceed in the same way as when integrating your real smartphone. If you open the menu in the AI Blocks Editor under the “Connect to Device” option, you will see the emulator listed with its identifier (for example, “emulator-5554”) and available for selection (see Figure 2.33). When you select it, the connection between emulator and AI IDE is created in the usual way. After a short period of time, you will see the app on the emulator.

Figure 2.33.

Figure 2.33. Selecting and integrating the emulator into the AI IDE

  • + Share This
  • 🔖 Save To Your Account