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

Native Development

Reply
Highlighted
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later
Accepted Solution

application background

Hi there, I want whenever user goes to background... to detect it and destroy the whole application..and send him to loginpage once he returns to my app..

 

any help?

 

 

Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: application background

or even if mobile device falls to black screen

Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: application background

saw this <permission>run_when_backgrounded</permission>

how can i disable it to run in backgroun or when device falls sleep.

my app i smobile banking one, and banking company for security reasons wants app to return to login page..first page if he goes backgroun or device falls sleep
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: application background

[ Edited ]

Firstly may I suggest that your suggestion is a bit extreme.

 

From a user point of view if the app shuts itself down when minimised or placed in the background then a user will believe it has crashed!

 

I have written a password locker program and the way it handles the situation I believe you are trying to account for is by locking in to the lock screen signal and on doing so it shows the password sheet again on the user returning.

 

If you wan to be extreme you could also set a lock screen on the app being minimised (signal asleep) and after a certain amount of time using a QTimer.

 

If you want to do the QTimer option you would need to keep the application running in the background and so set that permission to true.

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Contributor
Posts: 26
Registered: ‎07-24-2009
My Device: Not Specified
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: application background

found a solution, let me work on it..and if i hjave question i ask

 

res = QObject::connect(Application::instance(), SIGNAL(asleep()),
		        this, SLOT(asleep()));
		res = QObject::connect(Application::instance(),
		        SIGNAL(invisible()), this, SLOT(invisible()));

 

 

 

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: application background

In that regard I think you have misunderstood what the <run_when_backgrounded> permission does.

Setting this to false in your bar-descriptor will just prevent any theads from running it is not in any way a security feature.

 

This explains the different application states...

 

http://developer.blackberry.com/native/documentation/cascades/dev/states/


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: application background

Okay while I was typing I see you found the asleep, awake and invisible signals.

 

As I said above though please think about the user experience if you use these signals, how happy would a user be if eveytime he peeks to the hub or switches to another application after only a few seconds later on coming back he has to enter a password again?

 

You are better off with tying in to the lock screen and having a timer option (user choice on length f timer is nice to).

 

http://developer.blackberry.com/native/reference/cascades/bb__platform__homescreen.html

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: application background

thanks alot for suggestions, i will pass your info to my boss as well.
and see it with client. the thing is we are still not in start phase..as client still will give us requirements..and negotiations happening.


altho one thing i dislike ...i need to bring data from server side based on language chosen. if user goes to invisible mode..and changes language then returns to the app..he will still see the data from server side in english language. while he chose arabic.

this is why also invisble mode to loginpage i thought could be more helpful then qtimer..

will see.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: application background

[ Edited ]

In this situation you would need to tie in to the locale signals to detect a change and then interrupt the server download and restart the load in the correct language.

 

For this to happen you would need to enable the <run_when_backgrounded> permission.

 

Or alternatively, do the locale check in the onAwake slot and then do the reload in the appropriate language.

In this second option I would recommend a warning message to the user, stating that a locale change has been detected and the app will need to reload the data.

 

http://developer.blackberry.com/native/reference/cascades/bb__system__localehandler.html

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.