In the previous article, Create a Hello World! App, you created a Hello World! app in AppStudio. In this article, you import and run the app on a device simulator.
In this article, you:
- Install a simulator and mobile client app for your chosen device.
- Start the Hello World! app in the device simulator.
- Modify your app and run it in the simulator.
About device simulators
Each of the three main device types supported by AppStudio (Android, BlackBerry, and iOS) has their own device simulator. These simulators let you test and debug your app in a development environment before downloading it onto an actual device.
Appery does not ship the device simulators. You have to download and install a simulator from Google, RIM, or Apple.
Note: The iOS simulator is only available for Apple Mac based computers. Therefore, you require an Apple computer or VM to run the simulator.
About the AppStudio mobile client app
To run an app on a simulator or device, the AppServer downloads the app configuration information from the configuration database to the simulator or device. The app is then interpreted by the AppStudio mobile client application on the device.
The simulator or device requires that a mobile client be installed in order for the app configuration to be downloaded from the AppServer. There are several ways to get the mobile client onto the simulator or device, including:
- In a development environment, install the mobile client directly onto the simulator or device. Then configure the mobile client to reference your AppServer so that it can load the configuration information that defines your app. For more information on how to install the mobile client on a simulator, see Using Simulators.
- In a production environment, app users install the mobile client when they install a production app. For example, when a user installs an app from the Apple App Store, they also install the mobile client. For information about deploying apps in a production environment, see Deploying Apps.
- Upgrade an existing mobile client on a device. For more information, see Upgrading Client Software for Mobile Users.
Install a simulator and mobile client for your chosen device
You only have to install one simulator type for this article: Android, BlackBerry, or iOS. After you complete this process for one simulator type, you can repeat the process for other types.
The Dev Center contains instructions for installing and configuring each type of simulator:
Perform the simulator installation process at the links above to install the GSClient client app, but do not launch the GSClient app yet. You will do that below.
Start the Hello World! app in the simulator
After you install the mobile client on the simulator, you are ready to run the Hello World! app. The way you run the app depends on whether you are running a simulator for Android, BlackBerry, or iOS.
The procedures below for running the Hello World! app in the simulator assume that you configured IIS so that the AppServer is accessed by a URL in the form: Installing AppServer., where AppStudioApps corresponds to an IIS 7 or IIS 8 application name or an II6 virtual directory. For more information on configuring IIS, see
Start the Hello World! app in the Android simulator
This section describes how to start the Hello World! app in an Android simulator.
To run the Hello World! sample app in an Android simulator:
- Start the simulator. For information on installing and starting the Android simulator, see Using Android Simulators.
- Start the GSClient mobile client app that you installed when you configured the simulator. The login screen appears below:
- Click the Menu button on the device simulator. The application options appear at the bottom of the screen.
- Click the Options button. The Settings screen appears:
Enter the following information on the Settings screen:
URL:if the AppServer is running on your local machine, or replace the IP address with the IP address of a remote AppServer.
Authentication Type: Select the method of authentication from the drop down list. If you have not configured authentication for your application, choose None.
Application ID: If this is your first application, then the value is 1000. Each subsequent application has a value one greater. For example, if you create a second application in AppStudio, the Application ID will be 1001. If you do not know the Application ID for the Hello World! app, select the Applications Properties icon on the AppStudio toolbar. The Application ID appears at the top of the screen.
The application returns to the login screen.
- Enter a user name of mpdemo and click Login.
- The Hello World! screen appears.
Start the Hello World! app in the BlackBerry simulator
This section describes how to start the Hello World! app in a BlackBerry simulator. As part of running an app on a BlackBerry simulator, you have to configure the SD card.
To run the Hello World! sample app in the BlackBerry simulator:
- On the Windows desktop, start MDS by using the command: Start > Programs > Research In Motion > BlackBerry JDE 5.0.0 > MDS-CS.
- Start the device simulator by using the command: Start > Programs > Research In Motion > BlackBerry Smartphone Simulators X.0.0 > DeviceModel where X corresponds to a version number for DeviceModel.
- After the simulator starts, select Simulate > Change SD Card… on the menu bar.
- Click the Add SD Image button.
- Select a folder location where you want the SD Card file to be created.
- Click OK to close the SD Card window.
- Click the All button on the BlackBerry device to view all installed apps.
- Select the GSClient app to start it. The login screen appears below:
- Click the Blackberry menu button.
- Click Options
- Set the Application URL to if the AppServer is running on your local machine, or replace the IP address with the IP address of a remote AppServer..
- Leave Authentication to the default value None.
- Ensure the Connection Type is set to Corporate Server (BES/MDS)
- Press the down arrow three times and then press X on your computer keyboard.
- The AppID appears. If this is your first application, then the value is 1000. Each subsequent application has a value one greater. For example, if you create a second application in AppStudio, the Application ID will be 1001.
If you do not know the Application ID for the Hello World! app, select the Applications Properties icon on the AppStudio toolbar. The Application ID appears at the top of the screen.
- Click the Insert button on your computer keyboard to save your changes.
- If prompted, save your changes. You return to the GSClient login screen.
- Login as user mpdemo
- The Hello World! screen appears.
Start the Hello World! app in the iOS simulator
This section describes how to start the Hello World! app in an iOS simulator. The iOS simulator is only available for Apple Mac based computers. Therefore, you require an Apple computer or VM to run the simulator.
To run the Hello World! sample app in the iOS simulator:
- On the system hosting the AppServer, use the Windows ipconfig command to determine the system’s ip address.
Start the iOS simulator on a Mac.
The iOS simulator is located deep within the Xcode/SDK installation directory. To locate it, go to: HD > Developer > Platforms > iPhone Simulator Platform > Developer > Applications. Then create an alias referencing it or drop it on the Dock to provide easy access.
- At the top of your Mac display, you should see a menu line that includes the items “iOS Simulator...File....Edit...Hardware...Window...Help”
- Click Hardware > Device.
- Choose the device with which you want to work, e.g. iPhone or iPad.
- Click the device menu button.
- Click the Settings app.
- Click GSClient (the AppStudio app).
- Set the Server URL to the ipaddressOfAppServer/AppStudioApps/mp, for example
- Set the Application ID. Ensure it is set to the Hello World! app ID shown in AppStudio. It should be 1001. If you do not know the Application ID for the Hello World! app, select the Applications Properties icon on the AppStudio toolbar. The Application ID appears at the top of the screen.
- Click the menu button to return to the main display.
- Click GSClient. The login screen appears below:
- Login as mpdemo.
Note: After making changes to the app in AppStudio, you must exit and restart the app to download the new configuration.
Modify your app
After you modify and save an app in AppStudio, you have to refresh the app in the simulator or device to cause it to pick up the changes. There are two ways to refresh the app:
- Log out of the app on the simulator. When you restart the app and login, the app checks the server for any updates and downloads them automatically.
From the Home screen of the app, use the Refresh Config option. An update configuration is downloaded. The screen makes a small shake when the download is complete.
For iOS, you can only update the app from the Home screen if you add an About menu item to the app. Otherwise, on iOS, exit the application and restart it for the changes to take effect. For more information on menus, see Creating Screen Menus.
To update an app using Refresh Config:
- Add an Empty Space control and a second Button control to the app, below the Hello World button.
- For the Button control, set the Label property to “Hi”.
- Set the Screen Alignment of the Button control to Centered.
- Save the app.
- In the simulator, refresh the configuration by:
- On Android, press the simulator's menu key and then select Refresh Config.
- On Blackberry, press the Menu button in the app, and then select Refresh Config.
- On iOS, exit the application and restart it.
- Wait until the application shakes slightly, indicating that a new configuration was downloaded.
The new Button control appears.
Where to next