Creating and Deploying Java Applications for BlackBerry Making Sense of everything Eric Giguère Senior Software Architect giguere@ianywhere.com
Slide 2Overview Understanding J2ME by and large The BlackBerry point of view on J2ME Gathering the essential pieces Programming tips Moving past the BlackBerry
Slide 3About iAnywhere iAnywhere is the recognized pioneer in portable databases, versatile middleware, and versatile administration
Slide 4About Eric Practicing programming designer, broad involvement with portable stages and with a wide range of Java-based innovation Author of three books, including the primary book on Java 2 Micro Edition - more than 5 years of J2ME! Try not to purchase these, they're way obsolete!
Slide 5A Question Q: Why did the chicken cross the street? A: She was excessively bustling perusing her AvantGo channels on her BlackBerry. Indicate your BlackBerry Browser: rim.avantgo.com
Slide 6At the Sybase Booth Visit the Sybase corner in the Solutions Showcase for an exhibition of the new MobiLink Client API Sync social information down to the gadget and back SQL Server, Oracle, DB/2, ASE, SQL Anywhere Ask for Liam Or converse with me after the session (my code)
Slide 7Understanding J2ME
Slide 8Understanding J2ME Java 2 Micro Edition (J2ME) is an umbrella term for an arrangement of Java advancements made to run Java on less skilled gadgets Key ideas of designs , profiles and discretionary bundles : setup = VM + runtime classes (level) profile = space particular classes for building standalone applications (vertical) discretionary bundle = area particular classes that uncover particular usefulness yet not applications (flat or vertical)
Slide 9Configurations Only two arrangements characterized: Connected Limited Device Configuration (CLDC) Connected Device Configuration (CDC) CLDC is a stripped-down VM and runtime environment no conclusion, no reflection, just a couple classes CLDC 1.0 didn't bolster coasting point CDC is a superset of CLDC full dialect and VM bolster a much more extensive arrangement of standard Java 1.3 classes
Slide 10Profiles based on the CLDC: Mobile Information Device Profile (MIDP) Information Module Profile (IMP) "Headless" MIDP (no UI) Profiles based on the CDC: Foundation Profile Personal Basis Profile Built on top of Foundation Profile Personal Profile Build on top of Personal Basis Profile The move profile for the old PersonalJava
Slide 11Optional Packages Many discharged or being developed, a few cases: PIM Optional Package File Connection Optional Package Wireless Messaging API Mobile Media API Problem: not each gadget underpins each discretionary bundle
Slide 12Who Does All Of This? All J2ME benchmarks are created utilizing the Java Community Process (JCP) utilizing formal Java Specification Requests (JSRs) JSRs created by a specialist assemble (EG) speaking to the J2ME people group everywhere RIM is on the EGs for a few of the critical principles For more information, see http://www.jcp.org
Slide 13The BlackBerry Perspective
Slide 14BlackBerry and J2ME BlackBerry gadgets (Java-based) run MIDP and CLDC MIDP 1.0/CLDC 1.0 for 3.6/3.7 gadgets MIDP 2.0/CLDC 1.1 for 3.8/4.0 gadgets Custom Java VM Additional APIs accessible Some discretionary bundles Many BlackBerry-particular APIs (merchant augmentations) Built-in applications written in Java RIM eats it's own sustenance
Slide 15Application Models MIDlets Applications constructed utilizing MIDP application lifecycle and UI classes Portable to different stages unless BB APIs utilized BlackBerry applications Standard "open static void primary( String[] args )" passage guide Tied toward BlackBerry, yet more control over the application BlackBerry-particular UI classes Can keep running in foundation (no UI), on startup, and so on
Slide 16How Applications Are Built Classes are arranged as regular CLDC requires a different preverification step Output then changed utilizing RIM instruments into a .COD record that can be introduced on the gadget Applications can be stacked specifically through BlackBerry Desktop Manager, the javaloader apparatus, or remotely by means of over-the-air (OTA) provisioning
Slide 17How Applications Are Built Standard device is the Java Development Environment (JDE) incorporated proofreader, debugger Can likewise utilize Ant with Antenna undertakings See http://antenna.sourceforge.net Eclipse additionally conceivable utilizing Ant+Antenna Getting the classpaths right can be precarious See http://eclipseme.org for the EclipseME extend
Slide 18BlackBerry APIs Rich arrangement of BlackBerry-particular classes Utility classes to manage missing J2SE classes Different UI show than MIDP Encryption classes An industrious question demonstrate approximately designed on Java serialization More correspondence conventions, not simply HTTP Many APIs require your application to be marked
Slide 19Gotchas Occasionally classes are archived however not executed until somebody annoys RIM Only documentation is from RIM Javadocs needs some work, lacking numerous points of interest The main BlackBerry books accessible so far are about utilizing the gadget or making blackberry wine . In any case, no less than one BlackBerry programming book is coming Pester RIM for better docs and instrument upgrades!
Slide 20Gathering the Necessary Pieces
Slide 21Getting Started Download the JDE from http://www.blackberry.com Versions for 3.7 or 4.0 If you're going to target 3.6 or 3.7, utilize JDE 3.7 You'll likewise require Java SDK 1.4.2 http://java.sun.com/j2se/1.4.2/download.html New to Java? Locate some old books Ideally covering Java 1.1, not 1.2 or higher You won't get lured by all the new classes, particularly new 1.5 components like generics and enums But critical ideas like internal classes are secured
Slide 22Do You Need a BES? Edge ISV accomplices can buy a BES for improvement purposes helpful for testing applications can empower things that corporate BES forbids and for seeing how things are done IT might raise concerns not that simple to setup bear in mind a mail server is required Exchange needs its own particular NT area
Slide 23Code Signing Most "fascinating" APIs ensured, application won't keep running on gadget without being marked But you can run them in the test system Signing requires authentications got from RIM Small charge ($100) included Certificates required for every form machine Signing is an online-just process Communicates back to RIM Certificate proprietors gets email each time
Slide 24Programming Tips
Slide 25Reduce, Reuse, Recycle Don't make bunches of articles Garbage accumulation gobbles up CPU time Can come up short on question handles Look for chances to reuse objects Invariant classes great in principle, yet more sensible to permit changes Remember exhibits are items!
Slide 26Use Threads Always do I/O operations on an application-characterized string Don't hinder the framework occasion string Not just backs things off, yet may likewise bring about the application to solidify as framework tries to incite client for authorization Java threading systems are entirely great Take the push to learn them Good book is Concurrent Programming in Java by Doug Lea
Slide 27Keep Applications Small Don't run over the edge with internal and settled classes Think painstakingly about class connections and conditions Can you escape with utilizing a worked as a part of class rather than your own?
Slide 28HTTP or Sockets? In case you're utilizing MDS, attachments are an extraordinary choice Can likewise open a server attachment and listen for information to be pushed to your application Extra multifaceted nature of characterizing your own particular convention For non-MDS, HTTP is the best Easier to get past the firewall Support fluctuates extraordinarily via bearer, however HTTPS may likewise be accessible Easy to compose servlet that has similar information classes (Java on both closures)
Slide 29Start the MDS Simulator! In case you're doing system I/O, recollect to begin the MDS test system before you run your application in the gadget test system
Slide 30Moving Beyond the BlackBerry Non-BlackBerry J2ME gadgets turning out to be all the more intense Still generally purchaser situated later on, more will run the BlackBerry environment (BlackBerry Built-In) also Your BlackBerry applications will take a shot at BlackBerry Built-In with no progressions Things you underestimate in a MDS domain are not there Have to traverse the firewall Not as secure
Slide 31MIDP-Only Is One Option You can compose an application that exclusive uses APIs from MIDP and maybe a discretionary bundle or two Application gets bundled as JAR record and a going with JAD document Will keep running on most J2ME-empowered cellphones Except that there are numerous carriage usage
Slide 32Other Option: Split the Source Alternatively, construct two distinctive applications, one for BlackBerry, one for MIDP Split code into three sections One basic (no BlackBerry APIs, no UI) One for BlackBerry One for MIDP More mind boggling code because of utilization of processing plants and more interfaces and unique classes
Slide 33Q & A
SPONSORS
SPONSORS
SPONSORS