怎样实现Symbian 应用程序开机自启动

怎样实现 Symbian 应用程序开机自启动

1.在 data目录下创建一个资源文件,名字为 xxx.rss, 其中 xxx为任意符合编码规范的文件名均可。

例如, mylauncher.rss ,该资源文件内容如下所示:

#include <startupitem.rh>

 

RESOURCE STARTUP_ITEM_INFO startexe

    {

    executable_name = "c://sys//bin//TestLauncher_0xE8028B2A.exe" ;

    //or "!://sys//bin//TestLauncher_0xE8028B2A.exe", TestLauncher_0xE8028B2A.exe is your app name

    recovery = EStartupItemExPolicyNone;

}

2. 更新 MMP文件

START RESOURCE mylauncher.rss

TARGET mylauncher.rsc

END

3.   更新 PKG文件

pkg文件里面添加如下内容:

"C:/S60/devices/Nokia_N97_SDK_v1.0/epoc32/data/mylauncher.rsc " -"c:/private/101f875a/import/[E8028B2A ].rsc"

, 其中 mylauncher.rsc 为你先前新建的资源文件名, E8028B2A 为应用程序的 uid3 可以在 mmp 中查看。必须有中括号 [ ].

注意: sis 文件必须装在 c 盘,必须用开发者 证书签名。

 

如果你要设置是否开机自启动(如可以通过判断某文件是否存在来决定该程序是否在随机启动), 则需要继续执行下面的步骤:

4. 修改 ***_reg.rss 文件, 如这里的 TestLauncher_reg.rss,修改后的 TestLauncher_reg.rss文件如下:

(原文)

#include <uikon.rh>

(原文)

RESOURCE APP_REGISTRATION_INFO

      {

      …( 原文 )     

      opaque_data = r_startup_detect;

      }

 

RESOURCE NUMBER_INT8 r_startup_detect

    {

    value = 1;

}

5. ***AppUi.h ***AppUi.cpp 中实现 ProcessCommandParametersL

如这里的: TestLauncherAppUi.h:

class CTestLauncherAppUi : public CAknAppUi

      {

public :

// Inherit from CEikAppUi, for autostart.

TBool ProcessCommandParametersL (CApaCommandLine &aCommandLine);  

}

TestLauncherAppUi.cpp:

TBool CTestLauncherAppUi::ProcessCommandParametersL (CApaCommandLine &aCommandLine)

      {    

#ifndef __WINS__       

        if (aCommandLine.OpaqueData().Length() > 0)

            {    

            RDebug::Print(_L("CScpAutoStarter<=ApplicationStartsL 1 "));

            // Opaque data exists, app. has been manually started from the menu          

            }

        else

            {

          // App. has been auto-started -> exit if auto-start in settings is OFF

            TBool autoStart = ETrue;

            // we can change the bool variable autoStart under some conditions,

            // such as if the file is not exist, we can set autoStart to EFalse.

            if ( !autoStart )

                  {              

                User::Exit(0);

                  }

            else

                  {

              // Send the app to the background, after it was started up

                  }

            }

        return CEikAppUi::ProcessCommandParametersL( aCommandLine );

#endif      

      }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值