Home > Store

Kicking Butt with MIDP and MSA: Creating Great Mobile Applications

Register your product to gain access to bonus material or receive a coupon.

Kicking Butt with MIDP and MSA: Creating Great Mobile Applications

Book

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 2008
  • Dimensions: 7" x 9-1/4"
  • Pages: 432
  • Edition: 1st
  • Book
  • ISBN-10: 0-321-46342-0
  • ISBN-13: 978-0-321-46342-5

The release of MIDP 2.0 and the introduction of the new Mobile Service Architecture (MSA) are generating momentum for the Java ME platform. As more and more Java-enabled mobile devices become available and more service providers become open to third-party development, the demand for customized applications will grow dramatically. Now, there's a practical, realistic guide to building MIDP 2.0/MSA applications that are robust, responsive, maintainable, and fun.

Long-time Java ME author Jonathan Knudsen offers real solutions for the complex challenges of coding efficiency, application design, and usability in constrained mobile environments. Experienced Java developers will master MIDP 2.0 and MSA programming through clear, carefully designed examples. Downloadable code is available for both NetBeans Mobility Pack and the Sun Java Wireless Toolkit. Kicking Butt with MIDP and MSA's wide-ranging content covers:

  • Pushing MIDP's limits, and exploiting MSA's full power
  • Using MIDlets, Forms, commands, core classes, and invocation
  • Building effective mobile user interfaces
  • Designing graphics with the Canvas, the Game API, SVG, and 3D
  • Providing storage and resources: record stores, FileConnection, and PDA PIM
  • Internationalizing mobile applications
  • Networking via WMA, Bluetooth, Web services, and SIP
  • Parsing XML documents
  • Implementing audio and advanced multimedia
  • Securing mobile applications with SATSA and the Payment API
  • Building advanced location-based applications
  • Designing applications for multiple devices
  • Creating end-to-end mobile application architectures

Sample Content

Online Sample Chapter

Kicking Butt with MIDP and MSA: Text and Multimedia Messaging

Downloadable Sample Chapter

Download the chapter

Table of Contents

Foreword     xvii
Preface    xix
Acknowledgments    xxi
About the Author    xxiii

SECTION I: GETTING STARTED    1

Chapter 1: Overview    3

1.1    Not Plastics, but Wireless 3
1.2    MIDP, the Heart and Soul of Mobile Java Technology 4
1.3   The First Umbrella: JTWI 5
1.4    A Bigger Umbrella: MSA 6
1.5    Understanding MSA APIs 7
1.6    Looking beyond MSA 1.0 9
1.7    What about JavaFX Mobile? 10
1.8    Summary 10

Chapter 2: Tools    11

2.1    Sun Java Wireless Toolkit for CLDC: A Toaster Oven 11
2.2    NetBeans Mobility Pack: A Gourmet Kitchen 13
2.3    Eclipse, Too 13
2.4    Inside a MIDlet Suite 14
2.5    Building a MIDlet Suite 15
2.6    The Command Line: A Campfire 16
2.7    Preprocessors 17
2.8    Obfuscators 17
2.9    Emulators 18
2.10  Device Testing 18
2.11  Summary 19

Chapter 3: Quick Start    21

3.1    Make Something That Runs 21
3.2    Put Something on the Screen 22
3.3    Give the User Something to Do 23
3.4    Get the Source Code Online 25
3.5    Summary 26

Chapter 4: Core APIs    27

4.1    JVM Features You Might Miss 28
4.2    Strings, Primitive Types, and System Methods 28
4.3    Threads 29
4.4    Using Streams for Input and Output 30
4.5    Dates, Collections, and Random Numbers 32
4.6    Summary 33

SECTION II: THE LIVES OF MIDLETS 35

Chapter 5: The MIDlet Habitat    37

5.1    The MIDlet Life Cycle 37
5.2    Using the Browser and Making Calls 40
5.3    Application Properties 40
5.4    Protection Domains and Signed MIDlet Suites 41
5.5    Permissions 42
5.6    The Bottom Line on MIDlet Signing 44
5.7    Summary 45

Chapter 6: Starting MIDlets Automatically    47

6.1    Responding to Network Connections 47
6.2    Running a MIDlet at a Specific Time 54
6.3    Responding to Content 56
6.4    Summary 66

SECTION III: USER INTERFACE    67

Chapter 7: Basic User Interface    69

7.1    How to Show Screens 70
7.2    TextBox, the Runt of the Litter 71
7.3    Input Modes 72
7.4    Using Alerts for Notifications 73
7.5    A Very Quick Introduction to Images 74
7.6    Putting It Together 74
7.7    Good for the Old Ticker 76
7.8    The Whole Story on Commands 76
7.9    Command Placement 79
7.10  Summary 80

Chapter 8: More User Interface    81

8.1    Lists 81
8.2    List Selections 83
8.3    Handling List Events 83
8.4    Three Lists in One Example 84
8.5    Advanced List Control 86
8.6    Using Forms 86
8.7    Working with Items 88
8.8    Gauges 89
8.9    Controlling Item Layout 90
8.10  Please Drink Form Responsibly 92
8.11  Item Change Events and Item Commands 95
8.12  Summary 98

SECTION IV: GRAPHICS    99

Chapter 9: Creating Custom Screens    101

9.1    Getting Information about the Display 101
9.2    How Painting Works 102
9.3    Making Colors 102
9.4    Drawing Lines and Shapes 105
9.5    Drawing Text 109
9.6    Measuring Text 111
9.7    Creating Images 114
9.8    Drawing Images 116
9.9    Keeping Resources Small 118
9.10  Drawing on Images 119
9.11  Getting Your Fingers on the Bits 121
9.12  Clipping 124
9.13  Event Handling 124
9.14  Controlling Command Placement 127
9.15  Summary 129

Chapter 10: Custom Items    131

10.1    Custom Item Sizing 131
10.2    Painting 132
10.3    A Pretty Wait Indicator 132
10.4    Handling Events in Custom Items 135
10.5    Internal Traversal 136
10.6    An Interactive Example 137
10.7    Summary 142

Chapter 11: Using the Game API    143

11.1    Tight Looping with GameCanvas 143
11.2    Building Scenes with Layers 148
11.3    Tiled Layers 149
11.4    Sprites 151
11.5    Detecting Collisions 153
11.6    Assembling a Game Scene 153
11.7    A Blocky Example 154
11.8    Summary 158

Chapter 12: Scalable Vector Graphics    159

12.1    The Simplest Way to Show SVG Content 160
12.2    Working with Animated Documents 163
12.3    Digging into an SVG Document 166
12.4    Displaying an SVG Document on Your Own Canvas 168
12.5    Creating New SVG Elements 171
12.6    SVG Event Handling 174
12.7    Summary 178

Chapter 13: 3D Graphics    179

13.1    Creating M3G Files 179
13.2    Displaying 3D Content the Easy Way 180
13.3    Doing It the Hard Way 184
13.4    Summary 192

SECTION V: STORAGE AND RESOURCES    193

Chapter 14: Record Stores    195

14.1    Itsy Bitsy Teenie Weenie Databases 196
14.2    Working with Record Stores 196
14.3    Manipulating Records 198
14.4    Making Queries 199
14.5    Iterating through Records 199
14.6    A Place to Keep Your Stuff 200
14.7    Summary 204

Chapter 15: Reading and Writing Files    205

15.1    The Quick Story 205
15.2    Working with Files and Directories 206
15.3    Somewhere, a Place for Us 208
15.4    Finding Pictures, Music, and Other Goodies 208
15.5    Starting from the Top 209
15.6    Ask for Permission 209
15.7    An Example 210
15.8    Summary 213

Chapter 16: Contacts and Calendars    215

16.1    Understanding the PIM API 215
16.2    Working with Lists 217
16.3    Where Do Lists Come From? 220
16.4    Importing and Exporting 221
16.5    What's Supported? 222
16.6    Don't Forget Permissions 222
16.7    Example 223
16.8    Summary 232

Chapter 17: Mobile Internationalization    233

17.1    About Locales 233
17.2    Using Resources 234
17.3    Finding Resources 235
17.4    Resource Inheritance 237
17.5    Formatting Numbers and Dates 237
17.6    Sorting Strings 239
17.7    Take It Out for a Spin 239
17.8    Summary 244

SECTION VI: NETWORKING    245

Chapter 18: The Generic Connection Framework    247

18.1    Making Connections 247
18.2    Clean Up 249
18.3    Use Threads 250
18.4    Image Loading via HTTP 250
18.5    Advanced HTTP Techniques 252
18.6    Tips for Success 253
18.7    Using HTTPS 254
18.8    Other Connection Types 257
18.9    Incoming Connections 260
18.10  Connection Permissions 261
18.11  Summary 261

Chapter 19: Text and Multimedia Messaging    263

19.1    Why Messaging? 263
19.2    Sending Messages 264
19.3    Sending Binary Messages 265
19.4    Sending Multipart Messages 266
19.5    Receiving Messages 268
19.6    A Simple Messaging Application 269
19.7    Summary 273

Chapter 20: Bluetooth and OBEX    275

20.1    Control Your Own Bluetoothiness 276
20.2    Finding Other Bluetooth Devices and Services 276
20.3    Cheap Shots 278
20.4    Making a Client Connection 278
20.5    Setting Up a Server 279
20.6    Authorization and Encryption 280
20.7    What about OBEX? 280
20.8    Don't Forget the Push Registry 282
20.9    Permissions for Bluetooth and OBEX 282
20.10  The BlueChew Application 283
20.11  Summary 293

Chapter 21: XML and Web Services    295

21.1    Parsing XML 296
21.2    Creating a Handler 296
21.3    Parsing RSS 298
21.4    Parsing XML without JSR 172 301
21.5    Using WS-* Web Services 303
21.6    Harness the World 307
21.7    A Mobile Client for Flickr 308
21.8    Summary 317

Chapter 22: Session Initiation Protocol    319

22.1    Understanding SIP 320
22.2    Development Tools 321
22.3    Setting Up a Notifier 321
22.4    Sending Requests 321
22.5    Receiving SIP Requests and Sending Responses 322
22.6    GoSIP and SIPDemo 323
22.7    Summary 324

SECTION VII: MULTIMEDIA    325

Chapter 23: Playing and Recording Sound and Video    327

23.1    Boring Background Information 327
23.2    Tones 329
23.3    Using Players 329
23.4    Supported Content Types 331
23.5    Threading and Listening 332
23.6    Taking Control 332
23.7    Playing Sampled Audio Content 333
23.8    Playing Video Content 333
23.9    The Tone Sequence Player 335
23.10  The Interactive MIDI Player 336
23.11  Recording Audio 337
23.12  Capturing Video 338
23.13  You Can't Make Everyone Happy 338
23.14  About MMMIDlet 339
23.15  Summary 340

Chapter 24: Advanced Multimedia    341

24.1    Image Processing 342
24.2    Controlling Image Format 344
24.3    Music 345
24.4    3D Audio 345
24.5    Audio Special Effects 347
24.6    More Camera Control 347
24.7    Plain Old Radio 348
24.8    Summary 349

SECTION VIII: SECURITY AND TRANSACTIONS    351

Chapter 25: Smart Cards and Cryptography    353

25.1    Smart Cards? Really? 354
25.2    Testing SATSA Applications with the Emulator 354
25.3    Basic Smart Card Communication 355
25.4    Smart Card Communication with Java Card RMI 355
25.5    Generating Signatures 356
25.6    Managing Certificates 357
25.7    Cryptography 357
25.8    Summary 359

Chapter 26: Mobile Payments    361

26.1    Show Me the Money! 362
26.2    Matching Applications to Payment Providers 364
26.3    Editing Payment Provisioning Information 365
26.4    Security and Payments 366
26.5    Summary 366

Chapter 27: Know Where You Are    369

27.1    The Short Story 370
27.2    An Even Shorter Story 371
27.3    Receiving Periodic Location Updates 371
27.4    Getting Close 371
27.5    Landmark Databases 372
27.6    Orientation 373
27.7    Simulating Device Location 373
27.8    Summary 374

Chapter 28: Application Architecture    375

28.1    Use the Strengths of Java ME 375
28.2    Use the Strengths of the Internet 376
28.3    Don't Cram the Desktop into a DJava ME Application 376
28.4    Developing for Multiple Devices 377
28.5    Stretchy Screens 377
28.6    Make It Just Work 378
28.7    Summary 379

Index    381

Preface

Download the preface

Foreword

Download the foreword

Index

Download the index

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020