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

Web and WebWorks Development

Reply
New Contributor
Posts: 8
Registered: ‎01-16-2011
My Device: Blackberry 9700
My Carrier: Etisalat

Application state managment for auto-login

Hi guys,

I found this code example and i wanted to know what it does exactly.

 

blackberry.app.event.onExit(handleExit);
function handleExit() {
	blackberry.app.requestBackground();
}

 

 

Am just wondering how applications like "Facebook" and "Twitter" store user credentials to automatically log-in the next time the application opens, Do they use PIN validation, or store a cookie like file on the phone storage?

 

Thanks

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Application state managment for auto-login

The code you have quoted essentially sends the application to the background when the user exits the app.  It will leave the application running in the background instead of exiting its process.

 

For storing credentials you can do it various ways, cookies, HTML4 database, store session id's after initial login etc.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Application state managment for auto-login

The code snippet you've shown overrides the default behavior of exiting the application, and mimizes it to the background instead.

 

Likely, the Facebook and Twitter clients store some form of session key on the device (similar to how info can be saved in an HTTP cookie) that is used to automatically authenticate the user the next time they load the app.

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
New Contributor
Posts: 7
Registered: ‎03-09-2010
My Device: 9550
My Carrier: web developer

Re: Application state managment for auto-login

what is recommended for storing username and password? cookies is the easiest way of implementation, but is it safe?

Highlighted
Contributor
Posts: 41
Registered: ‎07-21-2011
My Device: Superberry
My Carrier: Rogers

Re: Application state managment for auto-login

Use the HTML 5 LocalStore:
http://www.blackberry.com/developers/docs/webworks/api/localStorage.html
----------------------------------------------------------------------------------------------
I kode for cudos! Or was it the other way around?
Developer
Posts: 268
Registered: ‎08-19-2009
My Device: Bold 9700

Re: Application state managment for auto-login

Old thread, I know. localStorage is only available on OS6+ and PlayBook. Can't use it if you support OS5.