Results 1 to 8 of 8
  1.    #1  
    Hey,

    how can I solve the problem.
    I want to push a Scene with some Informations about my App but i only want to push it when the app is used the first time and than the regular Scene should be pushed.

    thanks for your help!!!
  2. #2  
    weboshelp.net

    look up how to use cookies
  3. #3  
    Quick example:

    stageAssistant.jsjsjs:

    Code:
    firstUseCookie = new Mojo.Model.Cookie("firstUse");
    firstUse=firstUseCookie.get();
    if(!firstUse){
        this.controller.pushScene("firstRunScene");
    }else{
        this.controller.pushScene("mainScene");
    }
    Then in your firstUseScene you can set the cookie using:
    Code:
    firstUse=true;
    firstUseCookie = new Mojo.Model.Cookie("firstUse");
    firstUseCookie.put(firstUse);
    You can set that in your setup method which will cause the screen to not show again even if the user just opens the app then closes it without progressing beyond the first screen, or you can put it in your handler for whatever widget the user need to tap to proceed... Just put it before the pushScene command.
    Last edited by unfairSurprisery; 05/28/2010 at 11:43 AM. Reason: bad code tag.
    danNielson.com - Slalom - twitter - facebook
    A posted thanks dies with the thread. Clicking the button lasts until the admins get bored with this site and throw it in the recycling bin.
  4. #4  
    I get the impression there are occasional issues with the Pre tossing your cookies, so it would show again at that point. I don't know how frequent it is with apps, but I know it happens to me a lot on websites.
  5. pomokey's Avatar
    Posts
    526 Posts
    Global Posts
    540 Global Posts
    #5  
    cookies on websites have an expiration date. With apps it's different. the cookies can have an expiration date, but if you don't set it (like in unfair's example) it shouldn't expire. the only time they would see it again is if they uninstall and reinstall the app.

    if you wanted to prevent this, it's a bit more complicated... (you would need an external server's script to handle and save the first-run data)
    neathings - neatˇthings and apps for webOS
  6. #6  
    in web pages, if no expiration is set the cookie expires in 7 days if you set the cookie with javascript. In webos apps the cookie hangs around til you delete the app.
  7. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #7  
    haven't worked with cookies before, but if there turns out to be an issue with the reliability of the cookie sticking around [or not] then the same task can be accomplished with html 5 dbases. Check for the existence of a 'settings' table, for example. If not exists, then push 'first use'

    Palm Pre Backup Utility...done!
    Locate Pre....done!
  8. #8  
    @drew. using html5 databases for small amounts of information is rather massive overkill... And it's not recommended as it incurs a lot of overhead and requires quite a lot more code. For simple things like configuration, you really should just use cookies. Just keep in mind that your app can use more than one. And as I said before, for apps, you really don't need to worry about the cookies getting unset.
    danNielson.com - Slalom - twitter - facebook
    A posted thanks dies with the thread. Clicking the button lasts until the admins get bored with this site and throw it in the recycling bin.

Posting Permissions