Red Hat JBoss Developer Studio 10.2 Getting Started with JBoss

Red Hat JBoss Developer Studio 10.2 Getting Started with JBoss

Red Hat JBoss Developer Studio 10.2 Getting Started with JBoss Developer Studio Tools

You can manually initiate installation of JBoss Hybrid Mobile Tools and CordovaSim by locating them in the JBoss Central Software/Update tab or by dragging the following link into JBoss

Central: https://devstudio.jboss.com/central/install?connectors=org.jboss.tools.aerogear.hybrid

You can change the Cordova engine associated with the project after it is created. In the

Project Explorer view, right-click the project and click Properties. Click Hybrid Mobile

Engine and select the engine you want to use. Click OK to save the engine change and close the Properties window.

You can download multiple Cordova engines to your system with which to build your projects.

The Download wizard can be accessed from the Hybrid Mobile Engine pane in the project

Properties window, in addition to the Hybrid Mobile Project wizard.

From the IDE you can also initiate testing of Cordova projects with a connected Android device, system Android Emulator, and system iOS Simulator. The project is built in the necessary native format during the process.

With the CordovaSim control panel, you can generate simulated data for a range of device hardware, including geolocation and battery status. CordovaSim also manages camera actions, enabling you to upload system images to simulate receiving camera data.

A Shake button under Accelerometer in the CordovaSim control panel enables you to simulate a hardware-shake gesture and test the impact on your application.

2.8. IMPORTING AND DEVELOPING AN EXISTING FEEDHENRY

APPLICATION

The IDE includes an Import wizard to allow users to quickly and easily import previously created

FeedHenry applications. Once the application is imported, you can change or enhance the application, test the changes, and then push it back to the FeedHenry server.

Note

Before attempting to install or create a hybrid mobile project with JBoss Tools, ensure that the Android SDK is installed and up to date. Creating or installing hybrid mobile projects without a working and updated installation of Android SDK can result in unexpected errors.

Follow the provided steps to import and make changes to a FeedHenry application in your workspace:

1.

Section 2.8.5, “Importing Your FeedHenry Application”

2.

Section 2.8.7, “Changing the Application”

3.

Section 2.8.8, “Testing the Application”

4.

Section 2.8.9, “Pushing the Changes Back to the FeedHenry Server”

2.8.1. Prerequisites

Ensure that the following prerequisites are met to enable the FeedHenry feature:

94

CHAPTER 2. DEVELOPING FIRST APPLICATIONS WITH JBOSS DEVELOPER STUDIO TOOLS

Section 2.8.2, “Installing Android SDK”

Section 2.8.3, “Enabling the FeedHenry Feature”

Section 2.8.4, “Setting the Preferences for Your Application Import”

2.8.2. Installing Android SDK

To install Android SDK:

1. Download Android SDK and then unzip the file at a desired location.

2. In the IDE, click WindowPreferences.

3. In the Preferences window, type filter text field, type Hybrid Mobile.

4. In the Hybrid Mobile category, click Android.

5. Click Browse to locate and select the Android SDK directory on your machine.

Figure 2.42. Select the Android SDK Location

6. Click Apply and then click OK.

2.8.3. Enabling the FeedHenry Feature

To enable the FeedHenry feature:

1. In JBoss Central, click the Software/Update tab.

2. In the Features Available list, select the Hybrid Mobile Tools + CordovaSim

check box and then click Install/Update.

Figure 2.43. Hybrid Mobile Tools + CordovaSim Check Box Selected

95

Red Hat JBoss Developer Studio 10.2 Getting Started with JBoss Developer Studio Tools

96

3. Follow the on-screen instructions to complete the installation.

2.8.4. Setting the Preferences for Your Application Import

To set the preferences:

1. Click WindowPreferences.

2. In the Preferences window, in the search field type, FeedHenry and press Enter.

3. Complete the following fields in the Preferences window: a. Ensure that the Target URL field displays the URL to your FeedHenry server. The

URL to your FeedHenry server should be something like: https://[your-

studio-domain].feedhenry.com.

b. In the API Key field, copy and paste the API key from the FeedHenry website.

Figure 2.44. Setting Preferences for FeedHenry

CHAPTER 2. DEVELOPING FIRST APPLICATIONS WITH JBOSS DEVELOPER STUDIO TOOLS

Note

The user can either use an existing API key or generate a new one to set the preferences. To obtain the API key from the FeedHenry website click

SettingsAPI Key Management. To generate a new API key, click

SettingsAPI Key Management, and then click Add New Key.

4. Click Apply and then click OK to close the Preferences window.

2.8.5. Importing Your FeedHenry Application

Ensure that your Preferences are set before importing a FeedHenry application. If not set yet, you are prompted to set the preferences. These preferences are set once when importing an application for the first time and the configured preferences are used for all imports in the future.

To import your FeedHenry application:

1. Click FileImport.

2. Expand FeedHenry, click Import Cordova Application, and click Next.

3. The Import wizard displays the projects that you can import. Expand the project to import

an application from and select the FeedHenry application to be imported.

4. In the Directory field, enter the location where you want to clone the application locally.

5. Click Finish.

Figure 2.45. Selecting an Application to be Imported

97

Red Hat JBoss Developer Studio 10.2 Getting Started with JBoss Developer Studio Tools

98

If you have set a password for the SSH keys, you are prompted to enter the password so that it can import the application.

Result: The FeedHenry project is successfully imported and appears in the Project Explorer view. The Cordova config.xml file for this project opens in the Editor.

2.8.6. Testing the Application Import

To test the application import:

1. In the Project Explorer view, right-click the application and then click Run AsRun

w/remote FeedHenry server. A CordovaSim simulated device displaying the application appears.

Figure 2.46. Simulated Device Displaying the Imported Application

CHAPTER 2. DEVELOPING FIRST APPLICATIONS WITH JBOSS DEVELOPER STUDIO TOOLS

2. In the Enter Your Name Here field on the simulated device, type your name.

3. Click Say Hello From The Cloud.

99

Red Hat JBoss Developer Studio 10.2 Getting Started with JBoss Developer Studio Tools

Result: The simulated device displays the “Hello [Your Name]” string.

2.8.7. Changing the Application

After successfully importing the FeedHenry application, follow the instructions to change the application:

1. In the Project Explorer view, expand [application name]www and then double-

click index.html to open it using the Editor.

2. In the code, locate and delete the following line:

This is a basic Cordova App that can take in your name, send it to a cloud app and display the response.

3. Replace the deleted text with the following line:

Hello from Hybrid Mobile Tools!

4. Save the index.html file by pressing Ctrl+S. Alternatively, to save click FileSave or

click the Save icon.

Figure 2.47. The Edited index.html File

100

2.8.8. Testing the Application

To test the imported application, right-click the application and then click Run AsRun w/remote

FeedHenry server.

Figure 2.48. The Edited FeedHenry Application

CHAPTER 2. DEVELOPING FIRST APPLICATIONS WITH JBOSS DEVELOPER STUDIO TOOLS

The changes made to the index.html file are reflected on the simulated device. Click a corner of the displayed device to rotate it in that direction. Alternatively, right-click the simulated device and click Rotate Right or Rotate Left as to rotate it in the desired direction. To view the application on a different CordovaSim simulated device, right-click the device and click Skin. From

101

Red Hat JBoss Developer Studio 10.2 Getting Started with JBoss Developer Studio Tools

the list of skins, select a skin to view the application.

2.8.9. Pushing the Changes Back to the FeedHenry Server

Use the following instructions to push changes to the application back to the FeedHenry server:

1. In the Project Explorer view, right-click the application name.

2. Click TeamCommit.

3. In the Commit Changes window, Commit message field, type a message for the commit.

4. In the Files field, select the files that you have edited and want to push to the server and

then click Commit and Push.

5. In the Push Results [application name] window, ensure all the details are correct

and click OK.

6. Log into FeedHenry at https://[your-studio-domain].feedhenry.com.

7. Click Projects.

8. Click the Project Title under which your application is located and then click the

application.

Result: The simulated device in the App Preview section displays the change that you have just pushed to the FeedHenry server.

Figure 2.49. FeedHenry Application Edited and Displayed on the FeedHenry Server

102

CHAPTER 2. DEVELOPING FIRST APPLICATIONS WITH JBOSS DEVELOPER STUDIO TOOLS

2.8.10. Did You Know?

Add a new API key to your FeedHenry account by clicking Add New Key and then following the on-screen instructions.

Set up your SSH key in the FeedHenry account by clicking SettingsSSH Key

Management and then following the on-screen instructions.

2.8.11. Troubleshooting

2.8.11.1. Git Communication Error

Figure 2.50. Git Communication Error

103

Red Hat JBoss Developer Studio 10.2 Getting Started with JBoss Developer Studio Tools

Error Message

Problem when cloning the application. This can be due to a network problem or missing security credentials. Refer to error log for details.

Issue

When a FeedHenry account is set up, the user’s API Keys are configured by default, but the SSH

Public key must be manually configured. Importing a FeedHenry application means that the application repository is accessed via Git. Without a Public SSH key, the tools are unable to complete the action and this error appears.

Resolution

1. Click OK to close the Git Communication Error window.

2. Log into FeedHenry at: https://[your-studio-domain].feedhenry.com.

3. Click the icon located in the uppermost right-side corner of the screen to display the context

menu.

4. Click SettingsSSH Key Management and then click Add New Key.

5. In the Public Key field, enter your SSH Public key. An existing Public SSH key is

available at ~/.ssh/id_rsa.pub. Alternatively, generate a new Public SSH key with the following command:

$ ssh-keygen -t rsa -C "[email protected]"

2.8.11.2. Invalid Preferences

Figure 2.51. Invalid Preferences

104

CHAPTER 2. DEVELOPING FIRST APPLICATIONS WITH JBOSS DEVELOPER STUDIO TOOLS

Issue

When the user logs into FeedHenry for the first time, the Invalid Preferences dialog box appears informing the user that the FeedHenry connection preferences are unidentified or invalid and that the user must correct the preferences. Refer to the

Set the Preferences

section for details to set the connection preferences.

105

Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement

Table of contents