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: 151
Registered: ‎01-20-2010
My Device: Blackberry Bold

problem with turn off the phone SystemListener

Hi, everyone.

 

I have a background app where i use the gps every 5 minutes, get the coordinates, and store them in a DB, this works perfectly in a real device, now i want the app to run again when the user has turned off and later turned on the phone.

 

if i want to know if BB was turned on/turned off i'm implementing in this moment  SystemListener , with the methods powerUp and powerOff.

 

this is my code:

 

 

public final class GUILessApp extends UiApplication  implements SystemListener
{ 

public static void main(String[] args){
 if (args != null && args.length > 0 && "scheduler".equals(args[0]))
     {
		 GUILessApp obj= new GUILessApp();
		 obj.GPS();
     }
 	
 }
	public  GUILessApp(){
		Application.getApplication().addSystemListener( this);
 	}


public  void GPS(){
//ALL THE OPERATIONS WITH GPS (THIS PART WORKS PERFECT)
//IN THIS METHOD I SCHEDULE MY APP 
ApplicationManager.getApplicationManager().scheduleApplication(applicationDescriptor, System.currentTimeMillis()+300000, true);
}


  public void powerUp() {

writelog("turn on BB");
 		   ApplicationManager.getApplicationManager().scheduleApplication(desc, System.currentTimeMillis()+300000, true);
 	   }

public void powerOff() {
	
        writeLog("turn off");
		
	}.......

 

 

 

Someone can help me, i want to know why my app doesnt work after powerUp or where i can get more info.

Thanks

 

ps: Sorry for my english

 

Developer
Posts: 151
Registered: ‎01-20-2010
My Device: Blackberry Bold

Re: problem with turn off the phone SystemListener

Someone where i can get more info about this? thanks

Regular Contributor
Posts: 55
Registered: ‎05-30-2011
My Device: blackberry torch 9800

Re: problem with turn off the phone SystemListener

Hello

 

Did you resolved your issue,i am also getting the same issue.

Developer
Posts: 16,512
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: problem with turn off the phone SystemListener

please open an own thread and link to the existing one (next time).

most likely this issue is caused by misunderstanding a hard off (battery pull) and a soft off (red key).
the system listener can detect soft off only.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter