Thông tin tài liệu
King
BlackBerry Development
Companion
eBook
Available
Advanced
Advanced
BlackBerry
Development
Trim: 7.5 x 9.25 spine = 0.84375" 448 page count
Unlock the secrets of
advanced BlackBerry development
Chris King
COMPANION eBOOK SEE LAST PAGE FOR DETAILS ON $10 eBOOK VERSION
US $39.99
Shelve in
Mobile Computing
User level:
Intermediate-Advanced
www.apress.com
SOURCE CODE ONLINE
BOOKS FOR PROFESSIONALS BY PROFESSIONALS
®
this print for content only—size & color not accurate
CYAN
MAGENTA
YELLOW
BLACK
PANTONE 123 C
SPOT MATTE
ISBN 978-1-4302-2656-7
9 781430 226567
5 39 9 9
•
Learn to create, debug and deploy professional quality
BlackBerry applications
•
Discover the breadth of the BlackBerry platform and unlock its
potential.
•
Incorporate key features such as cryptography, video and text
messaging into your code
D
o you want to write compelling software for some of the most popu-
lar phones in the world? This book shows you how to write top-notch,
professional applications for the BlackBerry platform. In my career developing
mobile software I’ve found that vital information is often buried deep inside
multiple API documents, whitepapers, message boards, sample code, and the
heads of engineers who have fought against problems until they were solved.
Unless you’re lucky enough to work with a bright and friendly person who is
an expert with a lot of spare time on their hands, it’s dicult to get a compre-
hensive view of how everything hangs together. I enjoy writing BlackBerry
software, and have battled many of the issues that can trip up developers, so I
wrote this book to help others get over those hurdles. Building software is fun;
dealing with a phone’s foibles is not.
Once you get comfortable with the platform and its quirks, you’ll nd BlackBerry
programming very rewarding. You’ll learn about many of the cool features available
for your use, like recording audio, playing video, and sending text messages. You’ll
learn the deep voodoo of cryptography. Perhaps most exciting of all, you’ll see how
your applications can burrow into the phone’s core features, becoming indispens-
able to users.
Whether you’re a veteran looking for a map across the BlackBerry mineeld, or a
new recruit learning the lie of the land, this book will show you the best way to
achieve your objectives. I hope that, by the time you nish this book, you won’t just
know how to write great BlackBerry apps, but will be able to write them quickly and
get them working on as many phones as possible with as few headaches as pos-
sible. Good luck, and have fun!
Chris King is a software engineer specializing in mobile
development. Having developed applications for
BlackBerry, Android, Java ME, BREW, and Windows Mobile
devices, his software has been pre-loaded on tens of
millions of phones in the United States alone.
www.it-ebooks.info
Advanced BlackBerry
Development
■ ■ ■
Chris King
www.it-ebooks.info
Advanced BlackBerry Development
Copyright © 2009 by Chris King
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic
or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the
prior written permission of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-4302-2656-7
ISBN-13 (electronic): 978-1-4302-2657-4
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a
trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with
no intention of infringement of the trademark.
President and Publishing: Paul Manning
Lead Editor: Ewan Buckingham
Technical Reviewer: Levon Dolbakian
Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick,
Michelle Lowman, Matthew Moodie, Jeffrey Pepper, Frank Pohlmann, Ben Renow-Clarke, Dominic
Shakeshaft, Matt Wade, Tom Welsh
Coordinating Editor: Mary Tobin
Copy Editor: Kari Brooks-Copony and Mary Tobin
Compositor: LaurelTech
Indexer: BIM Indexing and e-Services
Artist: April Milne
Cover Designer: Anna Ishchenko
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York,
NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com, or visit
http://www.springeronline.com.
For information on translations, please e-mail info@apress.com, or visit http://www.apress.com.
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–
eBook Licensing web page at http://www.apress.com/info/bulksales.
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has
been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or
entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information
contained in this work.
The source code for this book is available to readers at http://www.apress.com. You will need to answer questions
pertaining to this book in order to successfully download the code.
www.it-ebooks.info
For Mom and Dad
www.it-ebooks.info
iv
Contents at a Glance
■ Part 1: Advanced APIs 1
■ Chapter 1: Getting Started 3
■ Chapter 2: Media Capture 41
■ Chapter 3: Media Playback 71
■ Chapter 4: Wireless Messaging 115
■ Chapter 5: Cryptography 163
■ Part 2: Device Integration 193
■ Chapter 6: Personal Information 195
■ Chapter 7: Browser 241
■ Chapter 8: Digging in Deep 277
■ Part 3: Going Pro 317
■ Chapter 9: RIM Security 319
■ Chapter 10: Porting Your App 349
■ Chapter 11: Advanced Build Techniques 379
■ Chapter 12: Conclusion 397
■ Appendix: Codec Support 401
■ Index 409
www.it-ebooks.info
v
Contents
Contents at a Glance iv
Contents v
About the Author x
Acknowledgments xi
Introduction xii
■ Part 1: Advanced APIs 1
■ Chapter 1: Getting Started 3
Initial Setup 3
Application Types 10
Connecting to Files and Networks 23
App: Media Grabber 30
Excelsior 39
■ Chapter 2: Media Capture 41
BlackBerry vs. Sun APIs 41
Creating a MediaPlayer 48
Controlling Output 49
Recording Audio 51
Using the Camera 53
www.it-ebooks.info
■ CONTENTS
vi
Video Capture 55
Invoking the RIM Alternative 56
App: Media Grabber 59
Excelsior 69
■ Chapter 3: Media Playback 71
Finding Content 71
Playing Audio 81
Playing Video 93
Displaying Images 93
Invoking Native Apps 101
App: Media Reviewer 103
Excelsior 113
■ Chapter 4: Wireless Messaging 115
The Messaging Quiver 115
Sending Text Messages 126
Sending Multimedia Messages 132
Plugging In to Email 135
Receiving Text Messages 145
Receiving MMS Messages 150
Reading Email 152
PIN Messaging 155
App: Sending and Receiving Media Messages 156
Excelsior 161
■ Chapter 5: Cryptography 163
Is It Secret? Is It Safe? 163
SATSA 167
Bouncy Castle 168
RIM Crypto Classes 173
Using the Certicom Classes 178
www.it-ebooks.info
■ CONTENTS
vii
Other Encryption Choices 180
App: Securing MediaGrabber 183
Excelsior 190
■ Part 2: Device Integration 193
■ Chapter 6: Personal Information 195
Address Book 195
Adding Contacts 206
Editing Contacts 207
Saving Contacts 212
Searching for Contacts 213
Reading Contact Data 217
Deleting Contacts 218
Invoking the Native Address Book 219
The BlackBerry Calendar 221
Using BlackBerry Calendar Events 226
Showing Calendars 228
I Have A ToDo List? 231
Take a Memo 233
Personal Changes 234
App: Selecting Recipients 236
Excelsior 239
■ Chapter 7: Browser 241
Browser Types 241
Web Development or App Development? 247
Launching the Browser 249
Embedding a Browser in Your App 253
Embedding Your App in a Browser 264
App: Friend Tracker 269
Excelsior 275
www.it-ebooks.info
■ CONTENTS
viii
■ Chapter 8: Digging in Deep 277
A Content Handling System 277
Iconic 298
Native Menus 304
App: Enter from Anywhere 308
Excelsior 316
■ Part 3: Going Pro 317
■ Chapter 9: RIM Security 319
The Ownership Question 319
Security Policies: “You Can’t Do That!” 320
User Permissions: “May I Do This?” 326
Firewall: “Don’t Go There” 337
MIDlet Permissions: “I Will Do These Things” 340
Application Signing: “Do I Know You?” 343
App: Ask for Permissions 343
Excelsior 347
■ Chapter 10: Porting Your App 349
Understanding Hardware Differences 349
Understanding OS Differences 360
Understanding Language Differences 363
Understanding Platform Differences 371
App: Localized Text 373
Excelsior 378
■ Chapter 11: Advanced Build Techniques 379
Moving Beyond Eclipse 379
Versioning Strategies 383
Debugging and Logging 387
Other Build Issues 389
App: Logging, Building, and Updating 392
www.it-ebooks.info
■ CONTENTS
ix
Excelsior 395
■ Chapter 12: Conclusion 397
Parting Shots 397
Resources 398
Summit 399
■ Appendix: Codec Support 401
Notes 406
■ Index 409
www.it-ebooks.info
[...]... you will see a new BlackBerry menu option at the top You will also have access to two new debug configurations: BlackBerry Device and BlackBerry Simulator Figure 1-1 shows what your Eclipse environment should look like once you have installed the Plug-in and started a new project www.it-ebooks.info CHAPTER 1: Getting Started Figure 1-1 Eclipse configured for BlackBerry development BlackBerry Programs... Provides a quick introduction to BlackBerry development You’ll see how to set up your programming environment and learn the fundamentals of Java development for BlackBerry Chapter 2, “Media Capture”: Shows how to record audio and video from within your application or other applications on the device Chapter 3, “Media Playback”: Describes the vast range of media types supported by BlackBerry and how to include... basics of BlackBerry app development You may linger, skim, or skip ahead as your patience demands Initial Setup As with any new language or platform, you will need to install some new software and set up your computer appropriately There are many different ways to run a successful BlackBerry project RIM supports only Windows development, but it has done a good job of releasing tools that enable development. .. http://www .blackberry. com/go/eclipseUpdate The BlackBerry Update Site will display Several options are available At a minimum, you will need to select the BlackBerry JDE Plug-in for Eclipse and at least one BlackBerry Component Pack www.it-ebooks.info 5 6 CHAPTER 1: Getting Started Note: You may be asked to enter a user name and password You can register for a free developer account on the BlackBerry. .. Anatomy Advanced BlackBerry Development is divided into three parts Each part concentrates on a particular theme The book was designed to be read in sequence, as each chapter builds on the chapters that come before, but veteran developers can easily move to the parts that interest them the most.Part 1, Advanced APIs” This first part of the book focuses on the rich feature set offered by modern BlackBerry. .. are new to BlackBerry development, you should start with Chapter 1, which offers an accelerated introduction to the platform Spend as much time here as you need and continue once you are comfortable with all the material You can continue reading the remainder of the book in sequence, working through all the examples and reading the notes ApprenticeIf you have some familiarity with BlackBerry development, ... look for the Java SE download You only need to install the Java Runtime Environment (JRE) However, if you plan on doing other Java development besides BlackBerry, you can download the full Java Development Kit (JDK), which also includes the JRE Tip: When installing any development software, I suggest you pick an install path that has no spaces in it For example, instead of installing to c:\Program... the BlackBerry APIs, particularly those related to media and wireless messaging, are similar or identical to their Java ME counterparts I point out the important differences within the text These developers should particularly focus on Chapter 1 for setting up their BlackBerry environment and Chapter 9 to learn about the critical differences between Java ME and BlackBerry security Master Finally, BlackBerry. .. going a little further, always learn something new I’ve found BlackBerry programming to be a particularly fun trail, and hope you will enjoy the journey too Keep striving, keep moving upward, and appreciate the view xv www.it-ebooks.info 210 www.it-ebooks.info Part 1 Advanced APIs The best BlackBerry apps take advantage of the rich set of advanced APIs available on this platform The chapters in Part... Figure 1-1 Eclipse configured for BlackBerry development BlackBerry Programs If you are developing for a personal BlackBerry device, you probably already have the BlackBerry Desktop Manager and the BlackBerry Device Manager installed If not, installing them is very easy Go to http://www .blackberry. com and look for the “Desktop Software” download You may need to select your provider and download the . King
BlackBerry Development
Companion
eBook
Available
Advanced
Advanced
BlackBerry
Development
Trim: 7.5 x 9.25 spine. alone.
www.it-ebooks.info
Advanced BlackBerry
Development
■ ■ ■
Chris King
www.it-ebooks.info
Advanced BlackBerry Development
Copyright ©
Ngày đăng: 16/03/2014, 05:20
Xem thêm: Advanced BlackBerry Development pptx, Advanced BlackBerry Development pptx