brihmon / sheel-ma3aya

Automatically exported from code.google.com/p/sheel-ma3aya
0 stars 0 forks source link

Sprint2: PS08T01: On closing app -> app must auto log out FB #122

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
================
User story
================
8) As a registered user, I should be able to log in to an application

================
Task
================
On signing out -> app must auto log out

Original issue reported on code.google.com by passant....@gmail.com on 9 Dec 2011 at 8:30

GoogleCodeExporter commented 9 years ago

Original comment by passant....@gmail.com on 9 Dec 2011 at 8:46

GoogleCodeExporter commented 9 years ago

Original comment by passant....@gmail.com on 9 Dec 2011 at 9:45

GoogleCodeExporter commented 9 years ago

Original comment by passant....@gmail.com on 25 Dec 2011 at 9:38

GoogleCodeExporter commented 9 years ago
The current problem is:
YOU CANNOT DIRECTLY DETECT WHEN A MOBILE APP IS CLOSED IN ANDROID

the point is android doesn't really close apps. It puts them in the background 
as long as you have memory. When you don't have memory, it kills them without 
handling any events
They have an event called onTerminate, BUTTT it works only on emulators and the 
documentation says that it will never be called in reality
http://developer.android.com/reference/android/app/Application.html

There are 4 possible solutions:
-------------------------------

1) Leaving it as is: already the user had the option to log out if they want to 
so its like a session. If he doesn't explicitly, then he will be able to enter 
app without login as long as his session is valid , otherwise he will have the 
login prompt automatically (DRAWBACK: If someone gets access to the mobile and 
does transactions with his name)

2) Same option but also reducing the time of the session : For example making 
the session duration (1 hour - reasonable it wouldn't last beyond that) (DRAW 
BACK: If the user wants to stay longer he'll have to login again + if someone 
gets access to mobile. REPLY: in most cases he won't need to and users 
shouldn't be allowed to overflow the servers for example with requests "our 
assumption the app is working in roaming mode" + mobiles are personal + the 
duration fo the session is small + user can always log out if he needs to and 
feels its safer)

3) Supposedly i can detect onMemoryLow event. Presumably, when memory gets low 
if the app is still running then there's a chance it will be terminated at any 
time thus I can assume as if it is terminated and logout (DRAW BACK: If app is 
running bs resources are tight and person is active that android does not plan 
on cutting him off, I will on my own :D)
http://developer.android.com/reference/android/app/Application.html

4) Logging the time user is active on the app and as soon as he leaves the app 
for more than n minutes... next time he is back he is required to login 
(DRAWBACK: more code + definition of he left the app "When should i take such 
logs - i'm thinking about oncreate for activities and onstart for app")
http://stackoverflow.com/questions/2092951/how-to-close-android-application

I AM CURRENTLY CHOOSING TO TRY THE <B>2ND</B> APPROACH

Original comment by passant....@gmail.com on 25 Dec 2011 at 12:48

GoogleCodeExporter commented 9 years ago
An enhancement would be showing a dialog telling the user that the session has 
expired and he needs to log in instead of directly diverting him. 

However, it needs sending stuff through the intent because it should be 
displayed oin the new activity (dash board activity) and I do not want to risk 
it now

(The code is written but it won't show because it is in the onRestart or 
onCreate so the activity is not shown then the method diverts to the dash board)

Original comment by passant....@gmail.com on 25 Dec 2011 at 9:29