×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    7

    Smile how to get the phone run time from start ?

    hi experts ,who can tell me how to get the run time from the phone start ,
    I make a autostart app, I want it auto start in some condition,so how can I know my application is start with the system ,or started by user . I have a not good idea, get the run time from phone start to judge.

  2. #2
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    74

    Re: how to get the phone run time from start ?

    要是autostart的模式,可以考虑 启动的同时,给你的程序发个消息,既然用户能操作,你应该是基于 appui框架,可以利用processMsg。
    TBool ProcessCommandParametersL(TApaCommand aCommand,TFileName& aDocumentName,const TDesC8& aTail);
    void ProcessMessageL(TUid aUid,const TDesC8& aParams);

    用户手工启动的话没这么个消息。

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    391

    Re: how to get the phone run time from start ?

    TBool ProcessCommandParametersL(TApaCommand aCommand,TFileName& aDocumentName,const TDesC8& aTail);
    void ProcessMessageL(TUid aUid,const TDesC8& aParams);

    有没有具体的实现啊
    Symbian1234

  4. #4
    Super Contributor
    Join Date
    Feb 2006
    Location
    Beijing
    Posts
    4,361

    Re: how to get the phone run time from start ?

    Hi Teddy, If you develop the autostart application on 3rd platform, you can use this method to check the application started by user or system:
    1. write some code in your *_reg.rss file:
    Code:
    #include <uikon.rh>   
    RESOURCE APP_REGISTRATION_INFO
    {
    //added this
      opaque_data = r_startup_detect;
    }      
    
    RESOURCE NUMBER_INT8 r_startup_detect
    {
        value = 1;
    }
    2. override ProcessCommandParametersL function in your AppUi:
    Code:
    Bool CYourAppUi::ProcessCommandParametersL( CApaCommandLine &aCommandLine )
    {
      if(aCommandLine.OpaqueData().Length() > 0)
      {
          // Wow, user run the app
      }
      else
      {
          // Wow, autostarted by System when reboot
      }
       return CEikAppUi::ProcessCommandParametersL( aCommandLine );
    }
    Stay Hungry. Stay Foolish.
    Sina Weibo:
    http://weibo.com/cxt728
    QQ Weibo:
    http://t.qq.com/Cxt_programmer

  5. #5
    Registered User
    Join Date
    Nov 2008
    Posts
    7

    Re: how to get the phone run time from start ?

    Quote Originally Posted by Cxt_programmer View Post
    Hi Teddy, If you develop the autostart application on 3rd platform, you can use this method to check the application started by user or system:
    1. write some code in your *_reg.rss file:
    Code:
    #include <uikon.rh>   
    RESOURCE APP_REGISTRATION_INFO
    {
    //added this
      opaque_data = r_startup_detect;
    }      
    
    RESOURCE NUMBER_INT8 r_startup_detect
    {
        value = 1;
    }
    2. override ProcessCommandParametersL function in your AppUi:
    Code:
    Bool CYourAppUi::ProcessCommandParametersL( CApaCommandLine &aCommandLine )
    {
      if(aCommandLine.OpaqueData().Length() > 0)
      {
          // Wow, user run the app
      }
      else
      {
          // Wow, autostarted by System when reboot
      }
       return CEikAppUi::ProcessCommandParametersL( aCommandLine );
    }


    thanks very much ,but I tested the two condition both show autostarted by system .

  6. #6
    Registered User
    Join Date
    Nov 2008
    Posts
    7

    Re: how to get the phone run time from start ?

    I clean the project ,delete all files with project name in epoc32 ,rebuilt ,then ok. Thanks.

  7. #7
    Super Contributor
    Join Date
    Feb 2006
    Location
    Beijing
    Posts
    4,361

    Re: how to get the phone run time from start ?

    Quote Originally Posted by Teddy_ View Post
    I clean the project ,delete all files with project name in epoc32 ,rebuilt ,then ok. Thanks.
    Thanks for your feedback.
    Stay Hungry. Stay Foolish.
    Sina Weibo:
    http://weibo.com/cxt728
    QQ Weibo:
    http://t.qq.com/Cxt_programmer

  8. #8
    Super Contributor
    Join Date
    Mar 2003
    Location
    Beijing
    Posts
    3,609

    Re: how to get the phone run time from start ?

    You may find the sample code "AutoStart.zip" from the "resources" link of my signature for more reference.
    Liuxg
    Forum Nokia <a href="http://wiki.forum.nokia.com/index.php/Qt_开发"><font color="red">Qt Application Development Resources</font></a>

Similar Threads

  1. Replies: 4
    Last Post: 2009-03-17, 05:39
  2. why program can not run in mobile phone ?
    By luohaibo in forum Symbian Tools & SDKs
    Replies: 9
    Last Post: 2009-03-05, 16:18
  3. Exe run when phone switch off..
    By aamitgupta in forum Symbian
    Replies: 10
    Last Post: 2008-12-12, 17:18
  4. application does not run on phone???
    By bthyaga in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 17
    Last Post: 2007-06-30, 09:38

Posting Permissions

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