×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    62

    [SOLVED] Displaying a login screen the first time app runs (but not subsequent times)

    Hi,

    I'm trying to display a login screen the first time my app runs, but not for all subsequent times the app is launched (assuming the correct login credentials were provided the first time).

    What would be the best way to do this using NetBeans Visual Midlet creator? I've tried using the switchDisplayable() method but I'm not having much luck.

    Thanks in advance.

    Edit:
    I managed to solve it...

    Code:
    switchDisplayable(null, getLoginScreen());
    // write post-action user code here
    try 
    {
                usernameAccessCodeRecordStore = RecordStore.openRecordStore("usernameaccesscode", true);
    
                if (usernameAccessCodeRecordStore.getNumRecords() != 0)
                {
                    switchDisplayable(null, getMainWindowList());
                }
                usernameAccessCodeRecordStore.closeRecordStore(); 
    } 
    catch (Exception ex)
    {
               System.out.println(ex);
    }
    Last edited by Infms; 2013-02-05 at 18:52.

  2. #2
    Super Contributor
    Join Date
    Nov 2003
    Location
    Bangalore , India
    Posts
    4,430

    Re: Displaying a login screen the first time an app runs (but not subsequent times)

    @Infms, I hope the query is solved and could be closed ?

    Regards
    Gopal

  3. #3
    Registered User
    Join Date
    Feb 2011
    Posts
    62

    Re: Displaying a login screen the first time an app runs (but not subsequent times)

    Hi Gopal,

    Yes it seems to be working fine. On app start-up I check the RecordStore to see if an entry exists (meaning the user has previously logged-in). If true, I display the next screen "switchDisplayable(null, getMainWindowList());" which effectively skips the login process.

    Thanks

  4. #4
    Nokia Developer Champion
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Displaying a login screen the first time an app runs (but not subsequent times)

    nice, another persistent storage solution might be to simply use a file with a value in it (0 = first time, 1 = not first time)...
    Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them.

  5. #5
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Displaying a login screen the first time an app runs (but not subsequent times)

    Quote Originally Posted by Infms View Post
    Hi Gopal,

    Yes it seems to be working fine. On app start-up I check the RecordStore to see if an entry exists (meaning the user has previously logged-in). If true, I display the next screen "switchDisplayable(null, getMainWindowList());" which effectively skips the login process.

    Thanks
    That good actually, however I have seen some wrong implementations in this kind of requirements, note that once you have successfully done with the first (Login) request and you have received the success response from the server then only add the data to the RMS.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  6. #6
    Registered User
    Join Date
    Feb 2011
    Posts
    62

    Re: Displaying a login screen the first time an app runs (but not subsequent times)

    Quote Originally Posted by raj_J2ME View Post
    That good actually, however I have seen some wrong implementations in this kind of requirements, note that once you have successfully done with the first (Login) request and you have received the success response from the server then only add the data to the RMS.
    Very good point. Thanks for bringing this to my attention. Cheers

Similar Threads

  1. application runs more than one time problem??
    By ram4soft in forum Symbian
    Replies: 7
    Last Post: 2010-06-22, 17:59
  2. some time it works some times it not ?
    By Arunesh in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2009-08-09, 03:00
  3. Application runs only one time
    By afka in forum Mobile Java General
    Replies: 2
    Last Post: 2007-04-20, 13:49
  4. displaying customer login and logout time
    By chickenyd in forum Mobile Java General
    Replies: 4
    Last Post: 2006-06-04, 15:55
  5. Embedded application gives panic when runs for the second time
    By hesham.galal in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2005-01-02, 20:42

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •