NFC/NfcReadNdefSmartTag/src/nfc/sample/Ndef/Read/NfcReadNdefSmartTag.java
/**
     * Standard entry point for a BlackBerry java application
     */
Standard entry point for a BlackBerry java application
Standard entry point for a BlackBerry java application
public static void main(String[] args) {
        System.out.println("XXXX starting NfcReadNdefSmartTag: #args=" + args.length);
        NfcReadNdefSmartTag myApp = new NfcReadNdefSmartTag();
        /*
         * Register with the event logger
         */
        Utilities.initLogging();
        Utilities.log("XXXX NfcReadNdefSmartTag has registered with EventLogger");
        Utilities.log("XXXX NfcReadNdefSmartTag: has #args=" + args.length);
        if (args.length > 0) {
            Utilities.log("XXXX args[0]=" + args[0]);
            if (args[0].equals("gui")) {
                launched_from_gui = true;
            } else {
                launched_from_gui = false;
            }
        } else {
            launched_from_gui = false;
        }
        if (launched_from_gui) {
            Utilities.log("XXXX NfcReadNdefSmartTag about to push listener registration screen");
            _screen = ListenerControlScreen.getInstance();
            myApp.pushScreen(_screen);
        } else {
            Utilities.log("XXXX NfcReadNdefSmartTag about to push event log screen");
            _screen = NfcReadNdefSmartTagScreen.getInstance();
            myApp.pushScreen(_screen);
        }
        Utilities.log("XXXX NfcReadNdefSmartTag about to enter event dispatcher");
        /*
         * Enter the event dispatcher to receive events and handle them
         */
        NdefListenerManager listener_mgr = NdefListenerManager.getInstance();
        NfcReadNdefSmartTagListener listener = NfcReadNdefSmartTagListener.getInstance();
        if (listener_mgr.is_listening()) {
            listener_mgr.registerListener(listener);
        }
        myApp.enterEventDispatcher();
    }
public static void main ( String [ ] args ) { System . out . println ( "XXXX starting NfcReadNdefSmartTag: #args=" + args . length ) ; NfcReadNdefSmartTag myApp = new NfcReadNdefSmartTag ( ) ; /*
         * Register with the event logger
         */ Utilities . initLogging ( ) ; Utilities . log ( "XXXX NfcReadNdefSmartTag has registered with EventLogger" ) ; Utilities . log ( "XXXX NfcReadNdefSmartTag: has #args=" + args . length ) ; if ( args . length > 0 ) { Utilities . log ( "XXXX args[0]=" + args [ 0 ] ) ; if ( args [ 0 ] . equals ( "gui" ) ) { launched_from_gui = true ; } else { launched_from_gui = false ; } } else { launched_from_gui = false ; } if ( launched_from_gui ) { Utilities . log ( "XXXX NfcReadNdefSmartTag about to push listener registration screen" ) ; _screen = ListenerControlScreen . getInstance ( ) ; myApp . pushScreen ( _screen ) ; } else { Utilities . log ( "XXXX NfcReadNdefSmartTag about to push event log screen" ) ; _screen = NfcReadNdefSmartTagScreen . getInstance ( ) ; myApp . pushScreen ( _screen ) ; } Utilities . log ( "XXXX NfcReadNdefSmartTag about to enter event dispatcher" ) ; /*
         * Enter the event dispatcher to receive events and handle them
         */ NdefListenerManager listener_mgr = NdefListenerManager . getInstance ( ) ; NfcReadNdefSmartTagListener listener = NfcReadNdefSmartTagListener . getInstance ( ) ; if ( listener_mgr . is_listening ( ) ) { listener_mgr . registerListener ( listener ) ; } myApp . enterEventDispatcher ( ) ; }
Standard entry point for a BlackBerry java application
Standard entry point for a BlackBerry java application
// we're being auto launched by the system because an NDEF message we're interested in has been read and this app was not running // listener needs to be re-registered so it can receive any imminent callback i.e. we could be registered but not actually listening