Olli
Olli

Reputation: 532

How to handle log out #appcelerator

I have created a page that will log the user in but if the user is opening the App for the first time, how do I handle this and direct him to the login page. I wanted to use

if (logIn == false) {//redirect};

It doesn't work for Titanium SDK studio.

Upvotes: 0

Views: 224

Answers (1)

Suraj kochale
Suraj kochale

Reputation: 973

You can use Titanium.App.Properties for this. example

if(Titanium.App.Properties.getBool("isFirstLogin",false)){
  //User Logged in first time
}

and whenever user logged in set isFirstLogin to true.

Titanium.App.Properties.setBool("isFirstLogin",true);

If you want to log the user out again in the future, you can remove the property

Titanium.App.Properties.removeProperty("isFirstLogin");

Upvotes: 4

Related Questions