Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
justindutoit
Posts: 392
Registered: 05-31-2009
Accepted Solution

System Listener added ok but powerUp afaik not firing

Hey. My app, in main(), adds a System Listener on cold boot (battery replaced), with no errors. However, the powerUp method below doesn't fire when I switch my BB off and on- press the red end button for 5 sec and then press again (a warm boot). How do you get powerUp to be called? Code is below.


                    MySystemListener msl = new MySystemListener();
                    MonthlySpend ms = new MonthlySpend();
                    ms.addSystemListener(msl);


    private static class MySystemListener implements SystemListener
    {
        public void batteryStatusChange(int a) {}
        public void batteryGood() {}
        public void batteryLow() {}
        public void powerOff() {}
       
        public void powerUp() {

        
                // PerformAnyReset... calls the Schedule, so if it does the reset, don't schedule twice
                if (!PerformAnyResetWhichWasScheduledWhilePhoneWasSwitchedOff())
                           ScheduleTotalResetForStartDateOfNextBillingCycle();
                               
                SetIconAndTitle();    
                ScheduleIconUpdateOvernight();
        
        
                String logMessage = "Warm booted";
                if (EventLogger.logEvent(0x4c9d3452d87922f2L, logMessage.getBytes(), EventLogger.ALWAYS_LOG)) {
                    System.out.println("Log Successful!");
                }

 

Please use plain text.
Developer
justindutoit
Posts: 392
Registered: 05-31-2009

Re: System Listener added ok but powerUp afaik not firing

Hey- fixed. The app itself has to be a SystemListener, not another class

 

J

Please use plain text.
Developer
peter_strange
Posts: 14,614
Registered: 07-14-2008

Re: System Listener added ok but powerUp afaik not firing

[ Edited ]

Not 100% sure that is true, though in my case, that is how I code it so I've not tried anything else.  Anyway, can you mark this as Solved please.

Please use plain text.