SlideShare ist ein Scribd-Unternehmen logo
1 von 55
Yellow Pepper
Mobile Financial Solutions




BLACKBERRY BASIC
        September 2010
AGENDA
 – BlackBerry Platform Overview
 – Developing for BlackBerry
   • Application Basics        •   Http Connections
   • User Interfaces           •   Persistence
      – Screens, Fields and    •   Background Applications
      Managers
                               •   Controlled APIs
      – Ui Event Handlers
      – Menus and Menu Items


 – Questions
BlackBerry Platform Overview
                                                                     Email



                      Internet
                                                                  HTTP(S)
                             HTTP(S)                BlackBerry                   App
                                                    Server with                 Server
                                                       MDS
                                       Firewall
                    Web Services                                   Web Server


• Security                               • Multiple Carrier/Network Support
• Standards Based Connectivity           • JAVA™ Based Wireless Handhelds
    • HTTP(s)/TCP                                 • J2ME Compliant
• Wireless ‘Push’                        • BlackBerry Browser, SDK & APIs
BlackBerry Platform Overview
• Browser Based Applications
   • Use the BlackBerry Browser to render and display data
   • Support for HTML, xHTML, WML and WML Script (support for
     JavaScript in 4.0)
   • Support for PUSH

• Custom Java Applications
   • Written in Java using J2ME and BlackBerry APIs
   • Custom user interface
   • Able to store and process data
   • Able to make HTTP/TCP connections to the server
   • Supports background applications and PUSH
AGENDA
 – BlackBerry Platform Overview
 – Developing for BlackBerry
   • Application Basics        •   Http Connections
   • User Interfaces           •   Persistence
      – Screens, Fields and    •   Background Applications
      Managers
                               •   Controlled APIs
      – Ui Event Handlers
      – Menus and Menu Items


 – Questions
Developing for BlackBerry
• Application Basics
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.container.*;
    import net.rim.device.api.ui.*;

    class HelloWorld extends UiApplication{

        public static void main(String[] args){
            HelloWorld myApp = new HelloWorld();
            myApp.enterEventDispatcher();
        }

        public HelloWorld(){
            MainScreen screen = new MainScreen();
            screen.add(new RichTextField(“Hello World!”));
            pushScreen(screen);
        }
    }
Developing for BlackBerry
• Application Basics
        public HelloWorld(){
             MainScreen screen = new MainScreen();
             screen.add(new RichTextField(“Hello World!”));
             pushScreen(screen);
         }


   • Typically, the constructor for the main class will set up the
     initial screen of the user interface
   • Once the first screen is displayed the application can respond
     to user input from the trackwheel or the keyboard
   • Add a screen to the stack using “pushScreen(Screen s)”
Developing for BlackBerry
• Application Basics
        public static void main(String[] args){
             HelloWorld myApp = new HelloWorld();
             myApp.enterEventDispatcher();
         }

   • The “main” method is called when the application is
     instructed to start.
   • The system passes in any arguments defined in the project
     properties
   • Typically, creates the main class and calls
     “enterEventDispatcher()” to start receiving and sending Ui
     events
   • Under normal circumstances “enterEventDispatcher()” does
     not return.
Developing for BlackBerry
• Application Basics
     class HelloWorld extends UiApplication{


   • Any application that does any Ui work must extend either the
     UiApplication class or the Application class
Developing for BlackBerry
• Application Basics
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.*;

class HelloWorld extends UiApplication{

   public static void main(String[] args){
       HelloWorld myApp = new HelloWorld();
       myApp.enterEventDispatcher();
   }

    public HelloWorld(){
        MainScreen screen = new MainScreen();
        screen.add(new RichTextField(“Hello
World!”));
        pushScreen(screen);
    }
}
AGENDA
 – BlackBerry Platform Overview
 – Developing for BlackBerry
   • Application Basics        •   Http Connections
   • User Interfaces           •   Persistence
      – Screens, Fields and    •   Background Applications
      Managers
                               •   Controlled APIs
      – Ui Event Handlers
      – Menus and Menu Items


 – Questions
Developing for BlackBerry
• User Interfaces
   • BlackBerry uses a Java Swing-like extendable user
     interface API.
   • All BlackBerry Ui Classes are members of
      • net.rim.device.api.ui
      • net.rim.device.api.ui.container
      • net.rim.device.api.ui.component
   • *Note* BlackBerry and MIDP Ui Classes are mutually
     exclusive, they can not be used in the same
     application.
Developing for BlackBerry
• User Interfaces
   • Field
       • Lowest Level UI Component
                                              Field
                                             Field
       • Capable of it’s own layout and
         painting

   • Manager
       • Contains Fields                    Manager
                                            Manager
       • Handles layout and focus for all
         contained fields
       • Handles scrolling.
                                             Screen
                                            Screen
   • Screen
       • Must have a delegate manager
       • Can be added to or removed from
         the display stack.
Developing for BlackBerry
• User Interfaces – Field
    • All displayable elements, except Menu and
      MenuItem, extend field and implement methods
      such as paint to display data in a specific way.
    • Some field types include:
RichTextField        Displays formatted text
EditField            Displays text which can be edited by the user
ListField            Displays a list of elements, each of which can be
                     selected
Bitmap Field         Displays a bitmap
DateField            Displays the day, month and year. Each of which
                     can be changed
Developing for BlackBerry
• User Interfaces – Manager
    • Extends field, this means that a manager is
      displayable.
    • Managers ‘layout’ child fields in a specific way and
      instructs them to paint themselves. They also
      handle any scrolling of the fields

VerticalFieldManager     Lays out child fields vertically
HorizontalFieldManager   Lays out child fields horizontally
FlowFieldManager         Lays out child fields horizontally then vertically when
                         it runs out of space on the current ‘line’
DialogFieldManager       Lays out an icon and a message left to right, then
                         user fields vertically.
Developing for BlackBerry
• User Interfaces – Screen
   • Extends Manager and hence can be displayed
   • Screens are ‘pushed’ or ‘popped’ onto and off of the
     Ui Stack. The screen on the top of the stack is
     currently visible.
   • Screens employ a delegate Manager to handle
     layout and scrolling.
      • Certain screens have a built in layout manager while
        others must have one specified at instantiation
Developing for BlackBerry
• User Interfaces – Screen
   • Screen types include

                         Screen
                        Screen



       FullScreen
      FullScreen                   PopupScreen
                                  PopupScreen


     MainScreen
     MainScreen          Dialog
                         Dialog                   Status
                                                 Status
Developing for BlackBerry
• User Interfaces
   • How do I implement an Interface?
             public HelloWorld(){
                 MainScreen screen = new MainScreen();
                 screen.add(new RichTextField(“Hello
         World!”));
                 pushScreen(screen);
             }

   • MainScreen has a built in delegate manager which it uses to
     layout the fields.
   • When we add a field to the screen, it simply passes it to it’s
     delegate manager for layout.
Developing for BlackBerry
• User Interfaces
   • A more complicated layout:
public HelloWorld(){
        MainScreen screen = new MainScreen();
        screen.setTitle(new LabelField("Hello World!"));
        FlowFieldManager flowManager = new FlowFieldManager();
        screen.add(flowManager);
        ButtonField button1 = new ButtonField("Button 1");
        ButtonField button2 = new ButtonField("Button 2");
        ButtonField button3 = new ButtonField("Button 3");
        flowManager.add(button1);
        flowManager.add(button2);
        flowManager.add(button3);
        screen.add(new SeparatorField());
        screen.add(new RichTextField("This is a Hello World! "
                                     +"Application with some
buttons"));
        pushScreen(screen);
    }
Developing for BlackBerry
• User Interfaces
   • A more complicated layout:
Developing for BlackBerry
• User Interfaces
   • Building custom Fields
       • Extend Field
       • Implement (at least) the layout and paint abstract
         methods.
       • The getPreferredWidth and getPreferredHeight methods
         should also be implemented for proper layout in some
         managers.
   • Building custom Managers
       • Extend Manager and implement (at least) sublayout,
          getpreferredHeight and getPreferredWidth.
       • sublayout should invoke each field's setPosition and
          layout methods
Developing for BlackBerry
• User Interfaces
   • Event Handlers
      • Listener-based approach
      • The Ui can listen for field and
        focus changes, scrolling,
        trackwheel and keyboard
        events
      • A listener must implement the
        appropriate listener interface.
           •Ex: FieldChangeListener
Developing for BlackBerry
• User Interfaces
    • Event Handlers
ButtonField button1 = new ButtonField("Button 1");
MyListener listener = new MyListener();
button1.addChangeListener(listener);
class MyListener implements FieldChangeListener{
    public void fieldChanged(Field field, int context){
        ButtonField button = (ButtonField)field;
        final String label = button.getLabel();
        UiApplication.getUiApplication().invokeLater(new
Runnable(){
             public void run(){
                 Status.show(label + " was pressed");
           }
        });
    }
}
Developing for BlackBerry
• User Interfaces
   • Event Handlers
Developing for BlackBerry
• User Interfaces
   • Event Handlers
      • The TrackwheelListener and KeyListener
        interfaces are the most commonly
        implemented
      • Found in net.rim.device.api.system
      • Allow a field to respond to user input events.
      • Added to a Screen object
      • Are able to but do not necessarily consume
        the events
Developing for BlackBerry
• User Interfaces
   • Event Handlers
class MyTrackwheelListener implements TrackwheelListener{
    public boolean trackwheelClick(int status, int time){
       UiApplication.getUiApplication().invokeLater(new Runnable(){
             public void run(){
                 Status.show("The Trackwheel was clicked");
             }
         });
         return true;
    }
    public boolean trackwheelRoll(int amount, int status, int
time){
         return false;
    }
    public boolean trackwheelUnclick(int status, int time){
         return false;
    }
}
Developing for BlackBerry
• User Interfaces
   • Event Handlers
Developing for BlackBerry
• User Interfaces
   • Menus and MenuItems
      • Menu displays a menu in the top right corner of
        the screen. A menu is a vertically arranged list
        of items.
      • A menu can display itself by calling it’s show
        method
      • MenuItems are runnable objects which are
        added to the menu.
      • The selected MenuItem is run by the system
        when the trackwheel is clicked.
Developing for BlackBerry
• User Interfaces
   • Menus and MenuItems
public boolean trackwheelClick(int status, int time){
    Menu menu = new Menu();
    MenuItem closeItem = new MenuItem("Close", 1000, 1000){
        public void run(){
            UiApplication.getUiApplication().invokeLater(new
Runnable(){
                 public void run(){
                     UiApplication.getUiApplication().popScreen(
                 }
            });
            System.exit(0);
        }
    };
    menu.add(closeItem);
    menu.show();
}
Developing for BlackBerry
• User Interfaces
   • Menus and MenuItems
Developing for BlackBerry
• User Interfaces
   • Fields, Managers and Screens
      • Fields display data
      • Managers layout Fields and handle scrolling
      • Screens have a delegate Manager and are added to the Ui Stack
        and are made visible
   • Ui Event Handlers
      • Listeners for field and focus changes
      • Use TrackwheelListeners and KeyListeners to perform actions
        based on user input
   • Menus and Menu Items
      • Runnable MenuItems are added to Menus
      • The system runs the MenuItem when the user selects it from a
        Menu
AGENDA
 – BlackBerry Platform Overview
 – Developing for BlackBerry
   • Application Basics        •   Http Connections
   • User Interfaces           •   Persistence
      – Screens, Fields and    •   Background Applications
      Managers
                               •   Controlled APIs
      – Ui Event Handlers
      – Menus and Menu Items


 – Questions
Developing for BlackBerry
• Connecting to the Network
   • BlackBerry can use MDS to connect to the Intranet or the
     Internet.
   • HTTP(s) and TCP (socket) connections are supported




                    Internet
                                                              HTTP(S)
                           HTTP(S)              BlackBerry                   App
                                                Server with                 Server
                                                   MDS
                                     Firewall
                  Web Services                                 Web Server
Developing for BlackBerry
• Connecting to the Network
   • The java.microedition.io classes are used to
     connect to the network
   • All connections should be executed on a separate
     thread to avoid blocking other applications.



                 Internet
                                                           HTTP(S)
                        HTTP(S)              BlackBerry                   App
                                             Server with                 Server
                                                MDS
                                  Firewall
               Web Services                                 Web Server
Developing for BlackBerry
• Connecting to the Network
   • HTTP Connections
Thread t = new Thread(new Runnable(){
        public void run(){
            try {
                // setup the connection
                HttpConnection http =
(HttpConnection)Connector.open(URL);
                http.setRequestMethod(requestMethod);

   • create the connection on a new Thread
   • use Connector.open to establish the connection,
     cast this connection to an HTTPConnection
   • Set the request method and any request headers
Developing for BlackBerry
• Connecting to the Network
   • HTTP Connections
             DataOutputStream out = null;
             int length = data.length();
             String slength = String.valueOf(length);
             http.setRequestProperty("Content-Length", slength);
             try {
                 out = http.openDataOutputStream();
                 out.write(data.getBytes());
             } catch (IOException ioe) {
                 //Handle any exceptions which may be thrown
             }
             out.close(); // close the output connection.

   • If there is any data to send to the server, write it to
     the output stream.
Developing for BlackBerry
• Connecting to the Network
   • HTTP Connections
             int received;
             InputStream in = http.openInputStream();
             StringBuffer response = new StringBuffer();
             while((received = in.read()) != -1){
                 response.append((char) received);
             }
             in.close(); // close the input stream


   • Use an InputStream to get the response from the
     server.
   • Get the response headers if needed at this point
Developing for BlackBerry
• Connecting to the Network
   • HTTP Connections
                 int httpStatus = http.getResponseCode();
                 //close the connections
                 http.close(); // close the HTTP connection
                 //do something with the response data and code
             }catch(IOException ioe) {
                 //handle any exception which may have been thrown
             }
        }
    });
t.start();

   • Finally, get the HTTP response code from the server
     and close the connection.
AGENDA
 – BlackBerry Platform Overview
 – Developing for BlackBerry
   • Application Basics        •   Http Connections
   • User Interfaces           •   Persistence
      – Screens, Fields and    •   Background Applications
      Managers
                               •   Controlled APIs
      – Ui Event Handlers
      – Menus and Menu Items


 – Questions
Developing for BlackBerry
• Persistence
   • Any application can save data in BlackBerry’s non-
     volatile flash memory. That data will persist across
     device resets
   • Any object which is marked ‘Persistable’ can be
     stored.
   • All API data types are Persistable
Developing for BlackBerry
• Persistence
class MyDataObject implements Persistable{
    // implementation of myDataObject
}


   • To be persistable a data class only needs to
     implement the Persistable interface.
   • Persistable has no methods or variables
Developing for BlackBerry
• Persistence
PersistentObject persist =
PersistentStore.getPersistentObject(fileName);
persist.setContents(myDataObject);

   • To save an object it simply needs to be added to the
     persistent store using a unique filename.
PersistentObject persist =
PersistentStore.getPersistentObject(fileName);
MyDataObject myDataObject = (MyDataObject)persist.getContents();

   • It can then be retrieved using that same filename
   • Persist.getContents() returns a reference to the Persistable
     object so any changes that are made to it at this point will be
     automatically saved when the application exits.
Developing for BlackBerry
• Persistence
   • A more robust implementation

MyDataObject myDataObject;
PersistentObject persist =
PersistentStore.getPersistentObject(fileName);
Object storedObject = persist.getContents();
if(storedObject == null || !(storedObject instanceof
MyDataObject)){
    persist.setContents(new MyDataObject());
    persist.commit();
    myDataObject = (MyDataObject)persist.getContents();
} else {
    myDataObject = (MyDataObject)storedObject;
}
AGENDA
 – BlackBerry Platform Overview
 – Developing for BlackBerry
   • Application Basics        •   Http Connections
   • User Interfaces           •   Persistence
      – Screens, Fields and    •   Background Applications
      Managers
                               •   Controlled APIs
      – Ui Event Handlers
      – Menus and Menu Items


 – Questions
Developing for BlackBerry
• Background Applications
   • Since BlackBerry is mutli-threaded it supports
     running processes in the background
   • These can be auto-run on startup or created by
     another application
      • Any process which could take more then a second to run
        should be executed on a separate thread
   • Background PUSH listeners are the most common
     type of background application.
Developing for BlackBerry
• Background Applications
   • Creating a background PUSH Listener
      • Build an application which starts a Listener thread. Mark
        that application as “auto-run at startup” and “System
        Module”.
Developing for BlackBerry
• Background Applications
   • Creating a background PUSH Listener
       • The system will run this applications main method when
         the handheld boots up.
       • The main method can start the listener thread

public static void main(String[] args){
    //start the background listener
    ListenerThread t = new ListenerThread();
    t.start();
}
Developing for BlackBerry
• Background Applications
   • Creating Alternate Application Entry Points
      • Create a project with just an application icon
      • Make that project an ‘Alternate CLDC Application Entry Point’
        for the main app.
Developing for BlackBerry
• Background Applications
   • Creating Alternate Application Entry Points
       • The argument for the Alternate entry point gets passed
         into the applications main method when the user clicks
         on the application icon.

public static void main(String[] args){
    if (args != null && args.length > 0 && args[0].equals("gui"))
{
        //start the UI
        BBTaskServerMain app = new BBTaskServerMain();
        app.enterEventDispatcher();
    }
}
Developing for BlackBerry
• Background Applications
   • Creating Alternate Application Entry Points
       • Put them together and the application can run the background
         listener on startup, and the Ui when the user selects the
         application Icon

public static void main(String[] args){
    if (args != null && args.length > 0 && args[0].equals("gui"))
{
        //start the UI
        BBTaskServerMain app = new BBTaskServerMain();
        app.enterEventDispatcher();
    }else{
        //start the background listener
        ListenerThread t = new ListenerThread();
        t.start();
    }
}
AGENDA
 – BlackBerry Platform Overview
 – Developing for BlackBerry
   • Application Basics        •   Http Connections
   • User Interfaces           •   Persistence
      – Screens, Fields and    •   Background Applications
      Managers
                               •   Controlled APIs
      – Ui Event Handlers
      – Menus and Menu Items


 – Questions
Developing for BlackBerry
• Controlled APIs
   • Any API which has the ability to access the system, the
     hardware, the crypto classes or any other applications data
     are signed.
   • The signed APIs are marked in the Java Docs
   • Any developer can use the signed APIs and run applications
     which use them under simulation
   • To run such an application on the handheld the application
     itself must be signed by the RIM signing servers.
Developing for BlackBerry
• Controlled APIs
   • Once the application
     has been built the
     JDE can be used to
     request signatures
     for the application.
Developing for BlackBerry
• Controlled APIs
   • The signature tool uses a hash of the application to
     generate proper signatures. BlackBerry checks for
     these signatures before it lets the application
     access a signed API.
Q&A

Weitere ähnliche Inhalte

Was ist angesagt?

"BlackBerry Webworks : Apps for The Smartphone and Tablet"
"BlackBerry Webworks : Apps for The Smartphone and Tablet""BlackBerry Webworks : Apps for The Smartphone and Tablet"
"BlackBerry Webworks : Apps for The Smartphone and Tablet"Software Park Thailand
 
Silver Light for every one by Subodh
Silver Light for every one by SubodhSilver Light for every one by Subodh
Silver Light for every one by SubodhSubodh Pushpak
 
Wintellect - Windows 8 for the Silverlight and WPF Developer
Wintellect   - Windows 8 for the Silverlight and WPF DeveloperWintellect   - Windows 8 for the Silverlight and WPF Developer
Wintellect - Windows 8 for the Silverlight and WPF DeveloperJeremy Likness
 
Developing Apps with CA Plex + CM WebClient
Developing Apps with CA Plex + CM WebClientDeveloping Apps with CA Plex + CM WebClient
Developing Apps with CA Plex + CM WebClientCM First Group
 
CM WebClient for CA Plex
CM WebClient for CA PlexCM WebClient for CA Plex
CM WebClient for CA PlexCM First Group
 
Lo sviluppo di Rich Interactive Applications Silverlight ed Expression Studio 2
Lo sviluppo di Rich Interactive Applications Silverlight ed Expression Studio 2Lo sviluppo di Rich Interactive Applications Silverlight ed Expression Studio 2
Lo sviluppo di Rich Interactive Applications Silverlight ed Expression Studio 2roberto.design
 
AD107 Microsoft SharePoint meets IBM Lotus Domino
AD107 Microsoft SharePoint meets IBM Lotus DominoAD107 Microsoft SharePoint meets IBM Lotus Domino
AD107 Microsoft SharePoint meets IBM Lotus DominoStephan H. Wissel
 
Silverlight overview
Silverlight overviewSilverlight overview
Silverlight overviewTaras Romanyk
 
Menus Implementation with IBM Rational HATS
Menus Implementation with IBM Rational HATSMenus Implementation with IBM Rational HATS
Menus Implementation with IBM Rational HATSRoyal Cyber Inc.
 
Lotus Sametime 8.5: Using the new Sametime System Console
Lotus Sametime 8.5: Using the new Sametime System ConsoleLotus Sametime 8.5: Using the new Sametime System Console
Lotus Sametime 8.5: Using the new Sametime System Consolejackdowning
 
What's new in Portal and WCM 8.5
What's new in Portal and WCM 8.5What's new in Portal and WCM 8.5
What's new in Portal and WCM 8.5Vinayak Tavargeri
 
What's new in ibm i notes 9.0
What's new in ibm i notes 9.0What's new in ibm i notes 9.0
What's new in ibm i notes 9.0Ranjit Rai
 
Introduction to j query mobile framework
Introduction to j query mobile frameworkIntroduction to j query mobile framework
Introduction to j query mobile frameworkShreerang Patwardhan
 

Was ist angesagt? (13)

"BlackBerry Webworks : Apps for The Smartphone and Tablet"
"BlackBerry Webworks : Apps for The Smartphone and Tablet""BlackBerry Webworks : Apps for The Smartphone and Tablet"
"BlackBerry Webworks : Apps for The Smartphone and Tablet"
 
Silver Light for every one by Subodh
Silver Light for every one by SubodhSilver Light for every one by Subodh
Silver Light for every one by Subodh
 
Wintellect - Windows 8 for the Silverlight and WPF Developer
Wintellect   - Windows 8 for the Silverlight and WPF DeveloperWintellect   - Windows 8 for the Silverlight and WPF Developer
Wintellect - Windows 8 for the Silverlight and WPF Developer
 
Developing Apps with CA Plex + CM WebClient
Developing Apps with CA Plex + CM WebClientDeveloping Apps with CA Plex + CM WebClient
Developing Apps with CA Plex + CM WebClient
 
CM WebClient for CA Plex
CM WebClient for CA PlexCM WebClient for CA Plex
CM WebClient for CA Plex
 
Lo sviluppo di Rich Interactive Applications Silverlight ed Expression Studio 2
Lo sviluppo di Rich Interactive Applications Silverlight ed Expression Studio 2Lo sviluppo di Rich Interactive Applications Silverlight ed Expression Studio 2
Lo sviluppo di Rich Interactive Applications Silverlight ed Expression Studio 2
 
AD107 Microsoft SharePoint meets IBM Lotus Domino
AD107 Microsoft SharePoint meets IBM Lotus DominoAD107 Microsoft SharePoint meets IBM Lotus Domino
AD107 Microsoft SharePoint meets IBM Lotus Domino
 
Silverlight overview
Silverlight overviewSilverlight overview
Silverlight overview
 
Menus Implementation with IBM Rational HATS
Menus Implementation with IBM Rational HATSMenus Implementation with IBM Rational HATS
Menus Implementation with IBM Rational HATS
 
Lotus Sametime 8.5: Using the new Sametime System Console
Lotus Sametime 8.5: Using the new Sametime System ConsoleLotus Sametime 8.5: Using the new Sametime System Console
Lotus Sametime 8.5: Using the new Sametime System Console
 
What's new in Portal and WCM 8.5
What's new in Portal and WCM 8.5What's new in Portal and WCM 8.5
What's new in Portal and WCM 8.5
 
What's new in ibm i notes 9.0
What's new in ibm i notes 9.0What's new in ibm i notes 9.0
What's new in ibm i notes 9.0
 
Introduction to j query mobile framework
Introduction to j query mobile frameworkIntroduction to j query mobile framework
Introduction to j query mobile framework
 

Andere mochten auch

Andere mochten auch (6)

WCF
WCFWCF
WCF
 
Twitter Bootstrap Presentation
Twitter Bootstrap PresentationTwitter Bootstrap Presentation
Twitter Bootstrap Presentation
 
SSL
SSLSSL
SSL
 
PCI DSS
PCI DSSPCI DSS
PCI DSS
 
Work life balance
Work life balanceWork life balance
Work life balance
 
Work life balance issues- How to deal with it.
Work life balance issues- How to deal with it.Work life balance issues- How to deal with it.
Work life balance issues- How to deal with it.
 

Ähnlich wie Mobile Financial Solutions Yellow Pepper BlackBerry BASIC September 2010

Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...DevClub_lv
 
Building Effective and Rapid Applications with IBM MobileFirst Platform
Building Effective and Rapid Applications with IBM MobileFirst PlatformBuilding Effective and Rapid Applications with IBM MobileFirst Platform
Building Effective and Rapid Applications with IBM MobileFirst PlatformAndrew Ferrier
 
Xamarin COE by Mukteswar Patnaik
Xamarin COE by Mukteswar PatnaikXamarin COE by Mukteswar Patnaik
Xamarin COE by Mukteswar PatnaikMukteswar Patnaik
 
Forum Nokia Dev. Camp - WRT training Paris_17&18 Nov.
Forum Nokia Dev. Camp - WRT training Paris_17&18 Nov.Forum Nokia Dev. Camp - WRT training Paris_17&18 Nov.
Forum Nokia Dev. Camp - WRT training Paris_17&18 Nov.DALEZ
 
Win j svsphonegap-damyan-petev-mihail-mateev
Win j svsphonegap-damyan-petev-mihail-mateevWin j svsphonegap-damyan-petev-mihail-mateev
Win j svsphonegap-damyan-petev-mihail-mateevMihail Mateev
 
WebWorks Development for BlackBerry PlayBook and Smartphones
WebWorks Development for BlackBerry PlayBook and SmartphonesWebWorks Development for BlackBerry PlayBook and Smartphones
WebWorks Development for BlackBerry PlayBook and SmartphonesKyle McInnes
 
Cross Platform Mobile Development
Cross Platform Mobile DevelopmentCross Platform Mobile Development
Cross Platform Mobile DevelopmentManesh Lad
 
Real-world Dojo Mobile
Real-world Dojo MobileReal-world Dojo Mobile
Real-world Dojo MobileAndrew Ferrier
 
Rich Internet Applications and Flex - 1
Rich Internet Applications and Flex - 1Rich Internet Applications and Flex - 1
Rich Internet Applications and Flex - 1Vijay Kalangi
 
Your last mile to SOA and Web 2.0- Lotus Expeditor for Devices - Eric MF Hsu,...
Your last mile to SOA and Web 2.0- Lotus Expeditor for Devices - Eric MF Hsu,...Your last mile to SOA and Web 2.0- Lotus Expeditor for Devices - Eric MF Hsu,...
Your last mile to SOA and Web 2.0- Lotus Expeditor for Devices - Eric MF Hsu,...mfrancis
 
Feed Herny developer training : crossplatform and HTML5
Feed Herny developer training : crossplatform and  HTML5Feed Herny developer training : crossplatform and  HTML5
Feed Herny developer training : crossplatform and HTML5Mobile Monday Brussels
 
BlackBerry Developer Overview
BlackBerry Developer OverviewBlackBerry Developer Overview
BlackBerry Developer OverviewKyle McInnes
 
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGapBuilding Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGapNick Landry
 
CA Plex on Apple Mac, iOS, Android
CA Plex on Apple Mac, iOS, AndroidCA Plex on Apple Mac, iOS, Android
CA Plex on Apple Mac, iOS, AndroidCM First Group
 
2 mobile development frameworks and tools dark temp
2   mobile development frameworks and tools dark temp2   mobile development frameworks and tools dark temp
2 mobile development frameworks and tools dark tempShahid Riaz
 
Android application development
Android application developmentAndroid application development
Android application developmentLinh Vi Tường
 

Ähnlich wie Mobile Financial Solutions Yellow Pepper BlackBerry BASIC September 2010 (20)

Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
 
Building Effective and Rapid Applications with IBM MobileFirst Platform
Building Effective and Rapid Applications with IBM MobileFirst PlatformBuilding Effective and Rapid Applications with IBM MobileFirst Platform
Building Effective and Rapid Applications with IBM MobileFirst Platform
 
Xamarin COE by Mukteswar Patnaik
Xamarin COE by Mukteswar PatnaikXamarin COE by Mukteswar Patnaik
Xamarin COE by Mukteswar Patnaik
 
Mobile web development
Mobile web development Mobile web development
Mobile web development
 
Forum Nokia Dev. Camp - WRT training Paris_17&18 Nov.
Forum Nokia Dev. Camp - WRT training Paris_17&18 Nov.Forum Nokia Dev. Camp - WRT training Paris_17&18 Nov.
Forum Nokia Dev. Camp - WRT training Paris_17&18 Nov.
 
Android quick talk
Android quick talkAndroid quick talk
Android quick talk
 
Win j svsphonegap-damyan-petev-mihail-mateev
Win j svsphonegap-damyan-petev-mihail-mateevWin j svsphonegap-damyan-petev-mihail-mateev
Win j svsphonegap-damyan-petev-mihail-mateev
 
WebWorks Development for BlackBerry PlayBook and Smartphones
WebWorks Development for BlackBerry PlayBook and SmartphonesWebWorks Development for BlackBerry PlayBook and Smartphones
WebWorks Development for BlackBerry PlayBook and Smartphones
 
Cross Platform Mobile Development
Cross Platform Mobile DevelopmentCross Platform Mobile Development
Cross Platform Mobile Development
 
Real-world Dojo Mobile
Real-world Dojo MobileReal-world Dojo Mobile
Real-world Dojo Mobile
 
Rich Internet Applications and Flex - 1
Rich Internet Applications and Flex - 1Rich Internet Applications and Flex - 1
Rich Internet Applications and Flex - 1
 
Your last mile to SOA and Web 2.0- Lotus Expeditor for Devices - Eric MF Hsu,...
Your last mile to SOA and Web 2.0- Lotus Expeditor for Devices - Eric MF Hsu,...Your last mile to SOA and Web 2.0- Lotus Expeditor for Devices - Eric MF Hsu,...
Your last mile to SOA and Web 2.0- Lotus Expeditor for Devices - Eric MF Hsu,...
 
Feed Herny developer training : crossplatform and HTML5
Feed Herny developer training : crossplatform and  HTML5Feed Herny developer training : crossplatform and  HTML5
Feed Herny developer training : crossplatform and HTML5
 
BlackBerry Developer Overview
BlackBerry Developer OverviewBlackBerry Developer Overview
BlackBerry Developer Overview
 
RAD in Action: FireUI
RAD in Action: FireUIRAD in Action: FireUI
RAD in Action: FireUI
 
Chalam_JAVA_Portal
Chalam_JAVA_PortalChalam_JAVA_Portal
Chalam_JAVA_Portal
 
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGapBuilding Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
 
CA Plex on Apple Mac, iOS, Android
CA Plex on Apple Mac, iOS, AndroidCA Plex on Apple Mac, iOS, Android
CA Plex on Apple Mac, iOS, Android
 
2 mobile development frameworks and tools dark temp
2   mobile development frameworks and tools dark temp2   mobile development frameworks and tools dark temp
2 mobile development frameworks and tools dark temp
 
Android application development
Android application developmentAndroid application development
Android application development
 

Mehr von Duy Do Phan

Location based AR & how it works
Location based AR & how it worksLocation based AR & how it works
Location based AR & how it worksDuy Do Phan
 
Linux Introduction
Linux IntroductionLinux Introduction
Linux IntroductionDuy Do Phan
 
Cryptography Fundamentals
Cryptography FundamentalsCryptography Fundamentals
Cryptography FundamentalsDuy Do Phan
 
Android Programming Basic
Android Programming BasicAndroid Programming Basic
Android Programming BasicDuy Do Phan
 
SMS-SMPP-Concepts
SMS-SMPP-ConceptsSMS-SMPP-Concepts
SMS-SMPP-ConceptsDuy Do Phan
 
One minute manager
One minute managerOne minute manager
One minute managerDuy Do Phan
 

Mehr von Duy Do Phan (8)

Location based AR & how it works
Location based AR & how it worksLocation based AR & how it works
Location based AR & how it works
 
Linux Introduction
Linux IntroductionLinux Introduction
Linux Introduction
 
Iso8583
Iso8583Iso8583
Iso8583
 
Cryptography Fundamentals
Cryptography FundamentalsCryptography Fundamentals
Cryptography Fundamentals
 
Android Programming Basic
Android Programming BasicAndroid Programming Basic
Android Programming Basic
 
iOS Basic
iOS BasiciOS Basic
iOS Basic
 
SMS-SMPP-Concepts
SMS-SMPP-ConceptsSMS-SMPP-Concepts
SMS-SMPP-Concepts
 
One minute manager
One minute managerOne minute manager
One minute manager
 

Mobile Financial Solutions Yellow Pepper BlackBerry BASIC September 2010

  • 1. Yellow Pepper Mobile Financial Solutions BLACKBERRY BASIC September 2010
  • 2. AGENDA – BlackBerry Platform Overview – Developing for BlackBerry • Application Basics • Http Connections • User Interfaces • Persistence – Screens, Fields and • Background Applications Managers • Controlled APIs – Ui Event Handlers – Menus and Menu Items – Questions
  • 3. BlackBerry Platform Overview Email Internet HTTP(S) HTTP(S) BlackBerry App Server with Server MDS Firewall Web Services Web Server • Security • Multiple Carrier/Network Support • Standards Based Connectivity • JAVA™ Based Wireless Handhelds • HTTP(s)/TCP • J2ME Compliant • Wireless ‘Push’ • BlackBerry Browser, SDK & APIs
  • 4. BlackBerry Platform Overview • Browser Based Applications • Use the BlackBerry Browser to render and display data • Support for HTML, xHTML, WML and WML Script (support for JavaScript in 4.0) • Support for PUSH • Custom Java Applications • Written in Java using J2ME and BlackBerry APIs • Custom user interface • Able to store and process data • Able to make HTTP/TCP connections to the server • Supports background applications and PUSH
  • 5. AGENDA – BlackBerry Platform Overview – Developing for BlackBerry • Application Basics • Http Connections • User Interfaces • Persistence – Screens, Fields and • Background Applications Managers • Controlled APIs – Ui Event Handlers – Menus and Menu Items – Questions
  • 6. Developing for BlackBerry • Application Basics import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.*; import net.rim.device.api.ui.*; class HelloWorld extends UiApplication{ public static void main(String[] args){ HelloWorld myApp = new HelloWorld(); myApp.enterEventDispatcher(); } public HelloWorld(){ MainScreen screen = new MainScreen(); screen.add(new RichTextField(“Hello World!”)); pushScreen(screen); } }
  • 7. Developing for BlackBerry • Application Basics public HelloWorld(){ MainScreen screen = new MainScreen(); screen.add(new RichTextField(“Hello World!”)); pushScreen(screen); } • Typically, the constructor for the main class will set up the initial screen of the user interface • Once the first screen is displayed the application can respond to user input from the trackwheel or the keyboard • Add a screen to the stack using “pushScreen(Screen s)”
  • 8. Developing for BlackBerry • Application Basics public static void main(String[] args){ HelloWorld myApp = new HelloWorld(); myApp.enterEventDispatcher(); } • The “main” method is called when the application is instructed to start. • The system passes in any arguments defined in the project properties • Typically, creates the main class and calls “enterEventDispatcher()” to start receiving and sending Ui events • Under normal circumstances “enterEventDispatcher()” does not return.
  • 9. Developing for BlackBerry • Application Basics class HelloWorld extends UiApplication{ • Any application that does any Ui work must extend either the UiApplication class or the Application class
  • 10. Developing for BlackBerry • Application Basics import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.*; import net.rim.device.api.ui.*; class HelloWorld extends UiApplication{ public static void main(String[] args){ HelloWorld myApp = new HelloWorld(); myApp.enterEventDispatcher(); } public HelloWorld(){ MainScreen screen = new MainScreen(); screen.add(new RichTextField(“Hello World!”)); pushScreen(screen); } }
  • 11. AGENDA – BlackBerry Platform Overview – Developing for BlackBerry • Application Basics • Http Connections • User Interfaces • Persistence – Screens, Fields and • Background Applications Managers • Controlled APIs – Ui Event Handlers – Menus and Menu Items – Questions
  • 12. Developing for BlackBerry • User Interfaces • BlackBerry uses a Java Swing-like extendable user interface API. • All BlackBerry Ui Classes are members of • net.rim.device.api.ui • net.rim.device.api.ui.container • net.rim.device.api.ui.component • *Note* BlackBerry and MIDP Ui Classes are mutually exclusive, they can not be used in the same application.
  • 13. Developing for BlackBerry • User Interfaces • Field • Lowest Level UI Component Field Field • Capable of it’s own layout and painting • Manager • Contains Fields Manager Manager • Handles layout and focus for all contained fields • Handles scrolling. Screen Screen • Screen • Must have a delegate manager • Can be added to or removed from the display stack.
  • 14. Developing for BlackBerry • User Interfaces – Field • All displayable elements, except Menu and MenuItem, extend field and implement methods such as paint to display data in a specific way. • Some field types include: RichTextField Displays formatted text EditField Displays text which can be edited by the user ListField Displays a list of elements, each of which can be selected Bitmap Field Displays a bitmap DateField Displays the day, month and year. Each of which can be changed
  • 15. Developing for BlackBerry • User Interfaces – Manager • Extends field, this means that a manager is displayable. • Managers ‘layout’ child fields in a specific way and instructs them to paint themselves. They also handle any scrolling of the fields VerticalFieldManager Lays out child fields vertically HorizontalFieldManager Lays out child fields horizontally FlowFieldManager Lays out child fields horizontally then vertically when it runs out of space on the current ‘line’ DialogFieldManager Lays out an icon and a message left to right, then user fields vertically.
  • 16. Developing for BlackBerry • User Interfaces – Screen • Extends Manager and hence can be displayed • Screens are ‘pushed’ or ‘popped’ onto and off of the Ui Stack. The screen on the top of the stack is currently visible. • Screens employ a delegate Manager to handle layout and scrolling. • Certain screens have a built in layout manager while others must have one specified at instantiation
  • 17. Developing for BlackBerry • User Interfaces – Screen • Screen types include Screen Screen FullScreen FullScreen PopupScreen PopupScreen MainScreen MainScreen Dialog Dialog Status Status
  • 18. Developing for BlackBerry • User Interfaces • How do I implement an Interface? public HelloWorld(){ MainScreen screen = new MainScreen(); screen.add(new RichTextField(“Hello World!”)); pushScreen(screen); } • MainScreen has a built in delegate manager which it uses to layout the fields. • When we add a field to the screen, it simply passes it to it’s delegate manager for layout.
  • 19. Developing for BlackBerry • User Interfaces • A more complicated layout: public HelloWorld(){ MainScreen screen = new MainScreen(); screen.setTitle(new LabelField("Hello World!")); FlowFieldManager flowManager = new FlowFieldManager(); screen.add(flowManager); ButtonField button1 = new ButtonField("Button 1"); ButtonField button2 = new ButtonField("Button 2"); ButtonField button3 = new ButtonField("Button 3"); flowManager.add(button1); flowManager.add(button2); flowManager.add(button3); screen.add(new SeparatorField()); screen.add(new RichTextField("This is a Hello World! " +"Application with some buttons")); pushScreen(screen); }
  • 20. Developing for BlackBerry • User Interfaces • A more complicated layout:
  • 21. Developing for BlackBerry • User Interfaces • Building custom Fields • Extend Field • Implement (at least) the layout and paint abstract methods. • The getPreferredWidth and getPreferredHeight methods should also be implemented for proper layout in some managers. • Building custom Managers • Extend Manager and implement (at least) sublayout, getpreferredHeight and getPreferredWidth. • sublayout should invoke each field's setPosition and layout methods
  • 22. Developing for BlackBerry • User Interfaces • Event Handlers • Listener-based approach • The Ui can listen for field and focus changes, scrolling, trackwheel and keyboard events • A listener must implement the appropriate listener interface. •Ex: FieldChangeListener
  • 23. Developing for BlackBerry • User Interfaces • Event Handlers ButtonField button1 = new ButtonField("Button 1"); MyListener listener = new MyListener(); button1.addChangeListener(listener); class MyListener implements FieldChangeListener{ public void fieldChanged(Field field, int context){ ButtonField button = (ButtonField)field; final String label = button.getLabel(); UiApplication.getUiApplication().invokeLater(new Runnable(){ public void run(){ Status.show(label + " was pressed"); } }); } }
  • 24. Developing for BlackBerry • User Interfaces • Event Handlers
  • 25. Developing for BlackBerry • User Interfaces • Event Handlers • The TrackwheelListener and KeyListener interfaces are the most commonly implemented • Found in net.rim.device.api.system • Allow a field to respond to user input events. • Added to a Screen object • Are able to but do not necessarily consume the events
  • 26. Developing for BlackBerry • User Interfaces • Event Handlers class MyTrackwheelListener implements TrackwheelListener{ public boolean trackwheelClick(int status, int time){ UiApplication.getUiApplication().invokeLater(new Runnable(){ public void run(){ Status.show("The Trackwheel was clicked"); } }); return true; } public boolean trackwheelRoll(int amount, int status, int time){ return false; } public boolean trackwheelUnclick(int status, int time){ return false; } }
  • 27. Developing for BlackBerry • User Interfaces • Event Handlers
  • 28. Developing for BlackBerry • User Interfaces • Menus and MenuItems • Menu displays a menu in the top right corner of the screen. A menu is a vertically arranged list of items. • A menu can display itself by calling it’s show method • MenuItems are runnable objects which are added to the menu. • The selected MenuItem is run by the system when the trackwheel is clicked.
  • 29. Developing for BlackBerry • User Interfaces • Menus and MenuItems public boolean trackwheelClick(int status, int time){ Menu menu = new Menu(); MenuItem closeItem = new MenuItem("Close", 1000, 1000){ public void run(){ UiApplication.getUiApplication().invokeLater(new Runnable(){ public void run(){ UiApplication.getUiApplication().popScreen( } }); System.exit(0); } }; menu.add(closeItem); menu.show(); }
  • 30. Developing for BlackBerry • User Interfaces • Menus and MenuItems
  • 31. Developing for BlackBerry • User Interfaces • Fields, Managers and Screens • Fields display data • Managers layout Fields and handle scrolling • Screens have a delegate Manager and are added to the Ui Stack and are made visible • Ui Event Handlers • Listeners for field and focus changes • Use TrackwheelListeners and KeyListeners to perform actions based on user input • Menus and Menu Items • Runnable MenuItems are added to Menus • The system runs the MenuItem when the user selects it from a Menu
  • 32. AGENDA – BlackBerry Platform Overview – Developing for BlackBerry • Application Basics • Http Connections • User Interfaces • Persistence – Screens, Fields and • Background Applications Managers • Controlled APIs – Ui Event Handlers – Menus and Menu Items – Questions
  • 33. Developing for BlackBerry • Connecting to the Network • BlackBerry can use MDS to connect to the Intranet or the Internet. • HTTP(s) and TCP (socket) connections are supported Internet HTTP(S) HTTP(S) BlackBerry App Server with Server MDS Firewall Web Services Web Server
  • 34. Developing for BlackBerry • Connecting to the Network • The java.microedition.io classes are used to connect to the network • All connections should be executed on a separate thread to avoid blocking other applications. Internet HTTP(S) HTTP(S) BlackBerry App Server with Server MDS Firewall Web Services Web Server
  • 35. Developing for BlackBerry • Connecting to the Network • HTTP Connections Thread t = new Thread(new Runnable(){ public void run(){ try { // setup the connection HttpConnection http = (HttpConnection)Connector.open(URL); http.setRequestMethod(requestMethod); • create the connection on a new Thread • use Connector.open to establish the connection, cast this connection to an HTTPConnection • Set the request method and any request headers
  • 36. Developing for BlackBerry • Connecting to the Network • HTTP Connections DataOutputStream out = null; int length = data.length(); String slength = String.valueOf(length); http.setRequestProperty("Content-Length", slength); try { out = http.openDataOutputStream(); out.write(data.getBytes()); } catch (IOException ioe) { //Handle any exceptions which may be thrown } out.close(); // close the output connection. • If there is any data to send to the server, write it to the output stream.
  • 37. Developing for BlackBerry • Connecting to the Network • HTTP Connections int received; InputStream in = http.openInputStream(); StringBuffer response = new StringBuffer(); while((received = in.read()) != -1){ response.append((char) received); } in.close(); // close the input stream • Use an InputStream to get the response from the server. • Get the response headers if needed at this point
  • 38. Developing for BlackBerry • Connecting to the Network • HTTP Connections int httpStatus = http.getResponseCode(); //close the connections http.close(); // close the HTTP connection //do something with the response data and code }catch(IOException ioe) { //handle any exception which may have been thrown } } }); t.start(); • Finally, get the HTTP response code from the server and close the connection.
  • 39. AGENDA – BlackBerry Platform Overview – Developing for BlackBerry • Application Basics • Http Connections • User Interfaces • Persistence – Screens, Fields and • Background Applications Managers • Controlled APIs – Ui Event Handlers – Menus and Menu Items – Questions
  • 40. Developing for BlackBerry • Persistence • Any application can save data in BlackBerry’s non- volatile flash memory. That data will persist across device resets • Any object which is marked ‘Persistable’ can be stored. • All API data types are Persistable
  • 41. Developing for BlackBerry • Persistence class MyDataObject implements Persistable{ // implementation of myDataObject } • To be persistable a data class only needs to implement the Persistable interface. • Persistable has no methods or variables
  • 42. Developing for BlackBerry • Persistence PersistentObject persist = PersistentStore.getPersistentObject(fileName); persist.setContents(myDataObject); • To save an object it simply needs to be added to the persistent store using a unique filename. PersistentObject persist = PersistentStore.getPersistentObject(fileName); MyDataObject myDataObject = (MyDataObject)persist.getContents(); • It can then be retrieved using that same filename • Persist.getContents() returns a reference to the Persistable object so any changes that are made to it at this point will be automatically saved when the application exits.
  • 43. Developing for BlackBerry • Persistence • A more robust implementation MyDataObject myDataObject; PersistentObject persist = PersistentStore.getPersistentObject(fileName); Object storedObject = persist.getContents(); if(storedObject == null || !(storedObject instanceof MyDataObject)){ persist.setContents(new MyDataObject()); persist.commit(); myDataObject = (MyDataObject)persist.getContents(); } else { myDataObject = (MyDataObject)storedObject; }
  • 44. AGENDA – BlackBerry Platform Overview – Developing for BlackBerry • Application Basics • Http Connections • User Interfaces • Persistence – Screens, Fields and • Background Applications Managers • Controlled APIs – Ui Event Handlers – Menus and Menu Items – Questions
  • 45. Developing for BlackBerry • Background Applications • Since BlackBerry is mutli-threaded it supports running processes in the background • These can be auto-run on startup or created by another application • Any process which could take more then a second to run should be executed on a separate thread • Background PUSH listeners are the most common type of background application.
  • 46. Developing for BlackBerry • Background Applications • Creating a background PUSH Listener • Build an application which starts a Listener thread. Mark that application as “auto-run at startup” and “System Module”.
  • 47. Developing for BlackBerry • Background Applications • Creating a background PUSH Listener • The system will run this applications main method when the handheld boots up. • The main method can start the listener thread public static void main(String[] args){ //start the background listener ListenerThread t = new ListenerThread(); t.start(); }
  • 48. Developing for BlackBerry • Background Applications • Creating Alternate Application Entry Points • Create a project with just an application icon • Make that project an ‘Alternate CLDC Application Entry Point’ for the main app.
  • 49. Developing for BlackBerry • Background Applications • Creating Alternate Application Entry Points • The argument for the Alternate entry point gets passed into the applications main method when the user clicks on the application icon. public static void main(String[] args){ if (args != null && args.length > 0 && args[0].equals("gui")) { //start the UI BBTaskServerMain app = new BBTaskServerMain(); app.enterEventDispatcher(); } }
  • 50. Developing for BlackBerry • Background Applications • Creating Alternate Application Entry Points • Put them together and the application can run the background listener on startup, and the Ui when the user selects the application Icon public static void main(String[] args){ if (args != null && args.length > 0 && args[0].equals("gui")) { //start the UI BBTaskServerMain app = new BBTaskServerMain(); app.enterEventDispatcher(); }else{ //start the background listener ListenerThread t = new ListenerThread(); t.start(); } }
  • 51. AGENDA – BlackBerry Platform Overview – Developing for BlackBerry • Application Basics • Http Connections • User Interfaces • Persistence – Screens, Fields and • Background Applications Managers • Controlled APIs – Ui Event Handlers – Menus and Menu Items – Questions
  • 52. Developing for BlackBerry • Controlled APIs • Any API which has the ability to access the system, the hardware, the crypto classes or any other applications data are signed. • The signed APIs are marked in the Java Docs • Any developer can use the signed APIs and run applications which use them under simulation • To run such an application on the handheld the application itself must be signed by the RIM signing servers.
  • 53. Developing for BlackBerry • Controlled APIs • Once the application has been built the JDE can be used to request signatures for the application.
  • 54. Developing for BlackBerry • Controlled APIs • The signature tool uses a hash of the application to generate proper signatures. BlackBerry checks for these signatures before it lets the application access a signed API.
  • 55. Q&A