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
Contributor
senthil_25
Posts: 45
Registered: ‎11-10-2010
My Device: Not Specified

Application auto start is not working in the simulator

I have developed an application which auto start after the 2 minutes.

I want the application to auto start after 2 minutes i have tested the application with the simulator but doesn't works.The application doesn't open after 2 minutes

 

Code is given below.

 

ApplicationManager manager = ApplicationManager.getApplicationManager();
ApplicationDescriptor descriptors[] = manager.getVisibleApplications();
int t=descriptors.length;

for(int i=0;i<t;i++)
String appname1 = descriptors[i].getName();
 
int h=Calendar.HOUR_OF_DAY;
int min=Calendar.MINUTE;
int sec=Calendar.SECOND;

int add=sec+2;
long time=((((h*60)+min)*60)+add)*1000;
boolean s=manager.scheduleApplication(descriptors[7], time, false);


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

Re: Application auto start is not working in the simulator

you are using constant values of calendar, they do not give you the current time.

you can use System.currentTimeMillis() to get the current time.
----------------------------------------------------------
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
Contributor
senthil_25
Posts: 45
Registered: ‎11-10-2010
My Device: Not Specified

Re: Application auto start is not working in the simulator

I tried the following code using System.currentTimeMillis()

 

Code

 

ApplicationDescriptor current = ApplicationDescriptor.currentApplicationDescriptor();

ApplicationManager.getApplicationManager().scheduleApplication(current, System.currentTimeMillis() + 60001, true);

 

The application doesn't  auto start after 1 minute from the current time.Here the scheduleApplication auto start the application after i open the application or auto start the application after the simulator is launched after 1 minute.