Simple Application Using Black Berry Browser Field

You can also display HTML content in your application using the BlackBerry Browser Field. In this example we use BlackBerry OS 5.0 JDE, which supports the later Browser Field version 2. Read about the differences between Browser Field version 1 and version 2 in chapter 14. The code is very similar to the previous example. Instead of creating an instance of RichTextField, we create an instance of the BrowserField class.

import net.rim.device.api.browser.field2.*;

import net.rim.device.api.ui.*;

import net.rim.device.api.ui.container.*;

public class HelloBrowser extends UiApplication {

public static void main(String[] args) {

HelloBrowser app = new HelloBrowser(); app.enterEventDispatcher();

public HelloBrowser() {

pushScreen(new HelloBrowserScreen());

class HelloBrowserScreen extends MainScreen {

public HelloBrowserScreen() {

BrowserField myBrowserField = new BrowserField(); add(myBrowserField);

myBrowserField.displayContent("<html><body><h1>Hello^

World!</h1></body></html>", "http://localhost"); }

Figure 4-8 shows the Hello Browser App Running in the Simulator.

You change this application to display HTML content from a web page by switching:

myBrowserField.displayContent("<html><body><h1>Hello^ World!</h1></body></html>", "http://localhost");

to myBrowserField.requestContent("http://www.blackberry.com");

Figure 4-8. Hello Browser App Running in the Simulator

Building for a BlackBerry Device

The BlackBerry simulator is quite good. There are versions for every BlackBerry model and it is effective for viewing your application with different screen dimensions and resolutions. However, there are always differences when you test on an actual device. For example, a UI element may seem usable when you are controlling it with mouse and key board shortcuts in the simulator, but on the physical device, you may find that a button is really too small to hit when you are using the Storm's touch screen. You should have a range of devices for testing and try it as early in the development process as possible.

Signing of applications is not required to run applications using the BlackBerry Smartphone simulator, but you must sign an application before you can install it on a BlackBerry smartphone device. Cryptographic keys can only be acquired from RIM.

You will need to fill out a web form [www.blackberry.com/SignedKeys/] to register for access to the BlackBerry runtime, application and cryptography APIs. Once registered, you will be sent a set of keys and installation instructions via e-mail that can be used to allow you to sign your applications using the BlackBerry Signature Tool. An administration fee of $20.00 will be charged to a valid credit card to complete the registration process. Allow a few days for RIM to process your application and send you your keys.

Code signing registration is solely for the purpose of monitoring usage of these particular APIs in third party application development and does not, in any way, indicate RIM's approval or endorsement of your application or your use of the APIs.

Over the Air (OTA) Distribution

You can distribute applications "over the air" by posting the files on the Web. BlackBerry Java OTA files consist of one .jad file and one or more .cod files.

Provide a link to the ".jad" file and when someone clicks that link in the Web browser on a BlackBerry device, the application will automatically download. If an application is too large to fit within the 128KB limit (64KB of application data and 64KB of resource data), it cannot be delivered as one large file, but must instead be broken up into a set of smaller files (as illustrated in Figure 4-9). This can be done automatically using the BlackBerry Java development tools.

RubyConf-RubyConf-RubyConf-RubyConf-RubyConf-RubyConf-RubyConf-RubyConf-RubyConf-RubyConf-RubyConf-RubyConf-RubyConf-RubyConf-RubyConf-RubyConf-RubyConf-RubyConf-RubyConf-RubyConf. RubyConf.

11 .cod

12 .cod

13 .cod 14.cod

15 .cod

16 .cod 17.cod

18 .cod

19 .cod

100X

93KB

93

.3KB/s

00

00

100/.

83KB

83

. 2KB/s

00

00

100/.

91KB

91

. lKB/s

00

00

100/.

85KB

85

.4KB/s

00

00

100/.

77KB

76

.7KB/s

00

00

100/.

57KB

56

.6KB/s

00

00

100/.

61KB

61

.0KB/S

00

00

100/.

49KB

49

.4KB/s

00

00

100/.

70KB

70

.0KB/s

00

00

100/.

81KB

80

. 6KB/s

00

00

100/.

20KB

20

. 3KB/s

00

00

100/.

65KB

65

.0KB/s

00

00

100/.

82KB

82

. lKB/s

00

00

100X

83KB

83

.4KB/s

00

00

100/.

85KB

85

. 2KB/s

00

00

100/.

79 KB

78

. 6KB/s

00

00

100/.

76 KB

75

.7KB/s

00

00

100/.

81KB

81

.4KB/s

00

00

100/.

90KB

89

. 9KB/s

00

00

100/.

90KB

90

.lKB/s

00

00

100/.

3140

3

. lKB/s

00

00

Figure 4-9. BlackBerry cod and jad files that compose the application for OTA distribution

BlackBerry App World

Research in Motion offers a marketplace for applications called "BlackBerry App World. To make your application available in BlackBerry App World, you must apply for a "Vendor Portal" (Figure 4-10) - this is in addition to, and separate from, registration for signing certificates.

Vendor Portal for BlackBerry App World

Welcome to the Vendor Portal for BlackBerry App World™

In order to have your application published in BlackBer World*" you must create a vendor account and submit the application for evaluation by RIM.

Password:

Create a vendor account following these easy steps:

1. Agree to the Vendor Agreement for BlackBerry App World

2. Enter your personal contact information

3. Enter your company contact information

4. Associate your PayPal account with your Vendor account. You must have a PayPal account in order to participate in the Vendor Portal for BlackBerry App World. A PayPal account is required for both consumer purchases and payments back to Vendors.

Once your account credentials have been confirmed you will receive a confirmation email with instructions on how you can begin submitting applications by RIM.

Applications must adhere to the BlackBerry Add World™ Vendor Guidelines in order to be considered for inclusion.

After your applications have been submitted, RIM will contact you regarding the results and next steps.

Get Started »

Figure 4-10. Vendor portal

Research in Motion offers a marketplace for applications called "BlackBerry App World." After you create a vendor account, you will be contacted via email to provide official documentation verifying your identity (Figure 4-11). As a company, you must provide articles of incorporation or a business license. As an individual, you must fill out a form and have it notarized.

From : BlackBerry App World Requests <[email protected]> Sub|ect: BlackBerry App World - RE: Vendor Application

Date: March 7, 2010 8:49:53 AM PST

To: undisclosed-recipients::

We are writing to inform you that your request for addition to Research In Motion's vendor list has been received. To complete the process, we require the following documentation:

If you are a Company:

■ Official documentation to validate your company information (ex. Articles of Incorporation,

Business License). Please scan or return in PDF format.

If you are an Individual:

■ Please complete the attached Notary Form and resubmit. We require the notary form in order to confirm your identity and date of birth. Anyone certified as a Notary can complete this for you (check your local listings).

Figure 4-11. BlackBerry App World request for documentation

Chapter

Was this article helpful?

0 -1
Living With Android

Living With Android

Get All The Support And Guidance You Need To Finally Be A Success At Using Android. This Book Is One Of The Most Valuable Resources In The World When It Comes To Playing With the Hottest Android Tablet.

Get My Free Ebook


Responses

Post a comment