Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 80
Registered: ‎03-19-2009
My Device: Not Specified

How to listen device reset notify ?

My app need do something when device reset. Is there any device reset notify ? How to listen it ? Help me ! Thanks ! Smiley Indifferent

PPCLINK Blackberry Team
The Best Software for Smartphone World.
Website : www.ppclink.com
Developer
Posts: 132
Registered: ‎05-07-2009
My Device: Curve
My Carrier: Vodafone

Re: How to listen device reset notify ?

Did you try SystemListener and SystemListener2? try them and pleas reply back.
Sameer Joshi
Blackberry developer.
Developer
Posts: 80
Registered: ‎03-19-2009
My Device: Not Specified

Re: How to listen device reset notify ?

Thanks mailsameer. I have tried but fail. I can not listen SystemListenner2.fastReset() and others.

PPCLINK Blackberry Team
The Best Software for Smartphone World.
Website : www.ppclink.com
Developer
Posts: 132
Registered: ‎05-07-2009
My Device: Curve
My Carrier: Vodafone

Re: How to listen device reset notify ?

Please show me your code. What are you doing? Those are the APIs to listen to these events. Did you register your listener?
Sameer Joshi
Blackberry developer.
Developer
Posts: 80
Registered: ‎03-19-2009
My Device: Not Specified

Re: How to listen device reset notify ?

I implement SystemListener2 and addSystemListener() in constructor of MainUIApplication class :

 

SystemListener2 sl2 = new SystemListener()

{

       void fastReset()

      {

        ....

       }

......

}

this.addSystemListener(sl2)


PPCLINK Blackberry Team
The Best Software for Smartphone World.
Website : www.ppclink.com
Developer
Posts: 132
Registered: ‎05-07-2009
My Device: Curve
My Carrier: Vodafone

Re: How to listen device reset notify ?

You are doing wrong,

 

Try the following:

 

class TheMainClass extends UiApplication implements SystemListener

{

     TheMainClass()  //Constructor

     {

           addSystemListener(this); //Registering the listener

     }

     //Override all the methods of the listener...... writing only 1 method here..... keep blank if you do not want to override....

     void powerOff()

     {

     }

}

Sameer Joshi
Blackberry developer.
Developer
Posts: 80
Registered: ‎03-19-2009
My Device: Not Specified

Re: How to listen device reset notify ?

I think your solution is similar with my solution. I implement SystemListener2 (not SystemListener) because SystemListener2 has fastReset() method (I need listen device reset notify, not powerOn or powerOfff). Thanks. Smiley Indifferent

PPCLINK Blackberry Team
The Best Software for Smartphone World.
Website : www.ppclink.com
Developer
Posts: 132
Registered: ‎05-07-2009
My Device: Curve
My Carrier: Vodafone

Re: How to listen device reset notify ?

No our solutions are completely different, You are making an object of SystemListener2, you can never make an object of interface,

 

so SystemListener2 alr2 = new  SystemListener2() will never work in lifetime., Please try as i suggested.

Sameer Joshi
Blackberry developer.
Regular Contributor
Posts: 61
Registered: ‎08-25-2010
My Device: Torch 9800
My Carrier: O2

Re: How to listen device reset notify ?

Actually you can make an object from an interface. It's called an anonymous class.

 

Think of all the method calls such as: UiApplication.getUiApplication().invokeLater(new Runnable() {

public void run() {}

});

 

The Runnable instance in the code example is an anonymous class, i.e. without a name, which implements the Runnable interface.

 

Please refrain from posting incorrect information.