David7661654
Posts: 0
Joined: Sun Jul 26, 2015 9:18 am

settings page on 1st use

Hello,

I prepared a "settings" page and I want the users to be forced to it if it's the app's first use.

How can I do that?

Thanks in advance.

David

Bob Fludder
Posts: 0
Joined: Fri Sep 14, 2012 1:09 am

settings page on 1st use

Hi David,

In the app settings you need to have a start page. That would be your "settings" page. From there to can navigate to wherever and use that new screen as the "home" page. If when you navigate to the "home" page from the "settings" page make sure you use "full screen refresh". I think that will control it. You can also look at the backbutton event to stop then getting back to the "settings" page (except via a menu option or button etc).

Have fun

Bob

David7661654
Posts: 0
Joined: Sun Jul 26, 2015 9:18 am

settings page on 1st use

Hi Bob,

Thank you for responding to my inquiry.

I set the "Settings" page as the app's start page, but, as I mentioned before, it only needs to load as start page the 1st time the app is started. By 1st time, I mean: "just after installation".

After that, if data is stored in the "Local Storage" (done when I entered it through the settings page), it should go to another page.

Is that possible?

Thanks,

David

Bob Fludder
Posts: 0
Joined: Fri Sep 14, 2012 1:09 am

settings page on 1st use

David,

Well... Not tried that myself but maybe create a "splash" screen. On page load check the local storage and based on that go wherever.

Bob

David7661654
Posts: 0
Joined: Sun Jul 26, 2015 9:18 am

settings page on 1st use

Sounds like the right approach. Any idea how to do that?

Bob Fludder
Posts: 0
Joined: Fri Sep 14, 2012 1:09 am

settings page on 1st use

Sorry. Had a deadline to meet. Well - on the "splash" screen put a bit of javascript in the load event. eg
if (localStorage.getItem("isRegistered") === null) { //you may want more checks here
Apperyio.navigateTo('Register', {});
}
else {
Apperyio.navigateTo('Welcome', {});
}

On the "register" screen when the "registration" is finished and validated just do something like
localStorage.setitem("isRegistered", "registered");

Some ideas at least. Oh also look at the Storage and Models documentation. Appery have some wrappers for local storage and also allows you to structure th storage as objects/arrays etc. Almost like a record in a table.

Bob

David7661654
Posts: 0
Joined: Sun Jul 26, 2015 9:18 am

settings page on 1st use

Hi Bob,

Thanks a lot for taking the time to help me out here.

I set in the load event of my "App settings Start page" the following JS (based on your suggested code):
codeif (localStorage.getItem("username") === null || localStorage.getItem("password") === null) {
Apperyio.navigateTo('Settings', {});
}/code

After clearing the app data, I ran it again and during loading, it showed me the Settings page, but only for a brief second and it ended up not staying on it and went back to the start page. Weird stuff :-(

Bob Fludder
Posts: 0
Joined: Fri Sep 14, 2012 1:09 am

settings page on 1st use

Hmmm. I tested it with 3 pages. Splash, Settings and Welcome. First was the splash. This was defined as the start page in the app settings. In there I had the JS to decide where to go next. I.E. if settings missing go to the settings page (the above JS). Otherwise go to the welcome back page. Yes the splash screen only showed briefly. You could also wrap the above code in a timer event so the splash displays a little longer and have a picture and some other meaningless stuff - like "your page will be re-directed shortly". On the settings page I put a button that updated the local storage variable and went to the welcome page. That was it.

Oh you did put the JS on the start page didn't you ? Not on the settings page and you have no events set up on the settings page ?

Return to “Issues”