12-28-2013 02:08 AM
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..
Solved! Go to Solution.
12-28-2013 03:45 AM
12-28-2013 04:43 AM - edited 12-28-2013 04:52 AM
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.
12-28-2013 04:44 AM
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()));
12-28-2013 04:47 AM
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...
12-28-2013 04:58 AM
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).
12-28-2013 05:38 AM
12-28-2013 06:32 AM - edited 12-28-2013 06:45 AM
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.