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