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
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: local notification based on time selected by the user and shoe msg

[ Edited ]

Sorry this makes no sense to me at all. 

"but when i closed the app i have match the time selected by the user to time fire by clockUpdated() in backgroung for notification"

http://www.catb.org/esr/faqs/smart-questions.html#writewell

 

If you have correctly used requestBackground() and not close(), your app should not be closed.  You should still see it in the task switcher which you can see by pressing and holding the Blackberry menu button (to the left of the trackpad).  And clockUpdated() is still invoked. 

 

So what is the problem?

 

Have you actually debugged this?

 

If the application is actually closed (so that you do not see it on the task switcher), then there is a problem in your processing and your code is not stopping the close correctly.  Debug that.  Do not post your code and ask us what is wrong with it.  You can do this on the SImulator. 

Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900

Re: local notification based on time selected by the user and shoe msg

yes, i have debug my code the app is not in background.i have remove the close()method and i use this UiApplication.getUiApplication().requestBackground(); to run my app in background
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: local notification based on time selected by the user and shoe msg

I am not sure what you are asking now. 

 

With your application in the background, is the clockUpdated() method being invoked?

Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900

Re: local notification based on time selected by the user and shoe msg

now u got my point, when my app is open state the clockUpdated() is working fine and giving me time after every minute
but now when application in the background the clockUpdated() method did not invoked invoked
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: local notification based on time selected by the user and shoe msg

[ Edited ]

I have already answered this question.  This is from a post a while back:

 

"If you have correctly used requestBackground() and not close(), your app should not be closed.  You should still see it in the task switcher which you can see by pressing and holding the Blackberry menu button (to the left of the trackpad).  And clockUpdated() is still invoked.

 

.....

 

If the application is actually closed (so that you do not see it on the task switcher), then there is a problem in your processing and your code is not stopping the close correctly.  Debug that. "

Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900

Re: local notification based on time selected by the user and shoe msg

yes i have debug mu code and when i switch to background i found following in my console
Detected background switch for Mytest(321) who has NO tunnels open - defocus NOT called
[0.0] Detected foreground switch for net_rim_bb_ribbon_app(88) who has NO tunnels open - focus NOT called
[0.0] FocusHistory: Focus gained; App Mytest; Component mypackage.HighResolutionScreen$9
[0.0] FocusHistory: Focus lost; App Mytest; Component mypackage.HighResolutionScreen$9
[0.0] FocusHistory: Focus gained; App net_rim_bb_ribbon_app; Component net.rim.device.apps.internal.ribbon[0.0] .launcher.RibbonIconField
[0.0] VM:NCICv=31
[0.0] Exit Mytest(321)
[0.0] Detected background switch for Mytest(321) who has NO tunnels open - defocus NOT called
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: local notification based on time selected by the user and shoe msg

"If you have correctly used requestBackground() and not close(), your app should not be closed.  You should still see it in the task switcher which you can see by pressing and holding the Blackberry menu button (to the left of the trackpad).  And clockUpdated() is still invoked.

 

.....

 

If the application is actually closed (so that you do not see it on the task switcher), then there is a problem in your processing and your code is not stopping the close correctly.  Debug that. "

 

So:

Is your application still visible on the task switcher?

Is your break point in clockUpdated() still invoked every minute?

 

In addition, create a button on your UI, called 'go to background'.  When the user clicks on that button, just call "requestBackground".  This is the processing your close should perform.  Test this with the button.  Using this button:

Is your application still visible on the task switcher?

Is your break point in clockUpdated() still invoked every minute?

 

If it works with the Button and doesn't work with the close, then you have problem in your close processing.  Debug that processing. 

 

By debug I do not mean show us what is in the log.  I mean you should use the debugger to step through your code to make sure it is doing what you want it to do. 

 

Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900

Re: local notification based on time selected by the user and shoe msg

[ Edited ]

thnks for our great advice,that really helps me. and my app will run successfully in background and my clockupdate() METHOD GIVES ME TIME on every minute.thats fine but when the when the app is background and time selected by the user matches with system time how can invoke a dialog for notification.

for example-i have selcetd time 9:00am for notification and when the system time that i got with  clockupdate() METHOD matches with selected time.and my app is in background the at that time how can i invoke  a dialog for notification.

 

Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900

Re: local notification based on time selected by the user and shoe msg

i more question that i have to ask is, in my app starts with splash screen and after that the app is in background that is working fine i have checked in switcher but when my app is in background and when i click the icon to bring my app to foreground then it would not starts from the splsh screen. i want to start my app from splash screen(first screen)  not from where it goes in background

Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: local notification based on time selected by the user and shoe msg

"when i click the icon to bring my app to foreground"

 

The Application activate() method is invoked at this time.  You might be able to use that to display the splash screen.

 

"how can invoke a dialog for notification"

 

Try this KB article:

http://supportforums.blackberry.com/t5/Java-Development/Alert-a-BlackBerry-smartphone-user-from-a-Ba...