Getting Started

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:

  1. Install a simulator and mobile client app for your chosen device.
  2. Start the Hello World! app in the device simulator.
  3. 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:

  1. 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.
  2. 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.
  3. 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: http://hostName/AppStudioApps, where AppStudioApps corresponds to an IIS 7 or IIS 8 application name or an II6 virtual directory. For more information on configuring IIS, see Installing AppServer.

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:

  1. Start the simulator. For information on installing and starting the Android simulator, see Using Android Simulators.
  2. Start the GSClient mobile client app that you installed when you configured the simulator. The login screen appears below:



  3. Click the Menu button on the device simulator. The application options appear at the bottom of the screen.
  4. Click the Options button. The Settings screen appears:
  5. Enter the following information on the Settings screen:


    1. URL: http://10.0.2.2/AppStudioApps/mp if the AppServer is running on your local machine, or replace the IP address with the IP address of a remote AppServer.

    2. Authentication Type: Select the method of authentication from the drop down list. If you have not configured authentication for your application, choose None.

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

    4. Click Save.

      The application returns to the login screen. 

  6. Enter a user name of mpdemo and click Login.
  7. 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:

  1. On the Windows desktop, start MDS by using the command: Start > Programs > Research In Motion > BlackBerry JDE 5.0.0 > MDS-CS.
  2. 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.
  3. After the simulator starts, select Simulate > Change SD Card… on the menu bar.
  4. Click the Add SD Image button.
  5. Select a folder location where you want the SD Card file to be created.
  6. Click OK to close the SD Card window.
  7. Click the All button on the BlackBerry device to view all installed apps.
  8. Select the GSClient app to start it. The login screen appears below:



  9. Click the Blackberry menu button.
  10. Click Options
  11. Set the Application URL to http://palmer/AppStudioApps/mp if the AppServer is running on your local machine, or replace the IP address with the IP address of a remote AppServer..
  12. Leave Authentication to the default value None.
  13. Ensure the Connection Type is set to Corporate Server (BES/MDS)
  14. Press the down arrow three times and then press X on your computer keyboard.
  15. 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.

  16. Click the Insert button on your computer keyboard to save your changes.
  17. If prompted, save your changes. You return to the GSClient login screen.
  18. Login as user mpdemo
  19. 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:

  1. On the system hosting the AppServer, use the Windows ipconfig command  to determine the system’s ip address.
  2. 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.

  3. At the top of your Mac display, you should see a menu line that includes the items  “iOS Simulator...File....Edit...Hardware...Window...Help”
  4. Click Hardware > Device.
  5. Choose the device with which you want to work, e.g. iPhone or iPad.
  6. Click the device menu button.
  7. Click the Settings app.
  8. Click GSClient (the AppStudio app).
  9. Set the Server URL to the ipaddressOfAppServer/AppStudioApps/mp, for example http://192.168.111.130/AppStudioApps/mp.
  10. 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.
  11. Click the menu button to return to the main display.
  12. Click GSClient. The login screen appears below:

  13. 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:

  1. Add an Empty Space control and a second Button control to the app, below the Hello World button.
  2. For the Button control, set the Label property to “Hi”.
  3. Set the Screen Alignment of the Button control to Centered.
  4. Save the app.
  5. In the simulator, refresh the configuration by:
    1. On Android, press the simulator's menu key and then select Refresh Config.
    2. On Blackberry, press the Menu button in the app, and then select Refresh Config.
    3. On iOS, exit the application and restart it.
  6. Wait until the application shakes slightly, indicating that a new configuration was downloaded.

    The new Button control appears.

Where to next

 

                                               
Your Rating: Results: PatheticBadOKGoodOutstanding! 19 rates