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
myraddin
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810
Accepted Solution

requestClose called by the system one hour after sending app to background

Hi,

 

Anyone experienced this?

 

The requestClose() got called after exactly one hour of app being in the background.



"Listen carefully, I shall say this only once"
Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: requestClose called by the system one hour after sending app to background

never saw that. seems to be a new OS 5 API, is it called by the system?
maybe you can just return false and be done with it, but some background information would be nice.
----------------------------------------------------------
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
Please use plain text.
Developer
myraddin
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: requestClose called by the system one hour after sending app to background

It arrives after one hour, no problem to repeat and most definitely called from the system.

Of course, I removed cleanup code and returned false just to keep it active in the background.

But then it gets repeated every minute. really strange, and annoying at the same time.

I tested this on 9810@7.0 device.
Will try to make a small app everyone could test but the scenario is:
1) Start UI app.
2) Send it to background.
3) wait one hour.



"Listen carefully, I shall say this only once"
Please use plain text.
Developer
myraddin
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: requestClose called by the system one hour after sending app to background

Indeed, by returning either true or false, the result is the same.

The docs are pretty inconclusive IMHO:

public boolean requestClose()
Individual apps can handle this new API call by cleaning up and then closing themselves, if they so desire. The individual app should return true if it's successful in terminating itself otherwise should return false.
Returns:
whether the application closed (true) or was sent to the background (false)

 

Nothing is said about why and when the system would invoke them or what would it use the returning value for.

IMO and tests confirm that (my app was still active in the background), the method signature could have been: void releaseUnnecessaryResourcesIfYouLike(). 

But why is it called after one hour and then repeatedly every minute... remains a mystery.

Or I am missing an important role intended for it?

 

In short, if I don't have anything to release, my app shouldn't implement that method.



"Listen carefully, I shall say this only once"
Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: requestClose called by the system one hour after sending app to background

I'll ask the powers to be :smileyhappy:
----------------------------------------------------------
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
Please use plain text.
Administrator
MSohm
Posts: 14,528
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: requestClose called by the system one hour after sending app to background

This method is used to notify applications that are in the background.  If an application has been deactivated for 1 hour it requests that it close.  This can be useful for applications that don't execute any background tasks.  The application may refuse to close (which is the default behaviour of requestClose()).

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
myraddin
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: requestClose called by the system one hour after sending app to background

So in short, this is like system asking the app:
"Excuse me, you are inactive for about one hour, did you forget to close yourself?"

And in fact, the returning value is ignored (since for both true or false - if app remains active in the background - the systems now asks similar question every minute).


"Listen carefully, I shall say this only once"
Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: requestClose called by the system one hour after sending app to background

The "every minute" aspect seems a bit strange to me, but otherwise it looks like a good feature - if anybody would know about it :smileyhappy:
----------------------------------------------------------
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
Please use plain text.
Developer
myraddin
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: requestClose called by the system one hour after sending app to background

Indeed!

Is there something like CPU deep sleep mode internally handled in BB?
Because if there is something like that, this one minute trigger could deny it thus 'wasting' battery even though it isn't doing anything useful.


"Listen carefully, I shall say this only once"
Please use plain text.