Symbian Special Interest Group

Sig Is symbian special interest Group

« How to check if an application is in fore/background in UIQ关于Fat »

How to prevent build-in camera application to be autolaunched

If your phone has a camera, nomrally if you open the camera cover, there will be a build-in app to be launched to captrue phones. But when you write your own camera apps, you might not want the build-in app to be launched, how to do this?

The theory is quite simple, camera cover open/close event is actually a KeyEvent, if you can capture this KeyEvent which window server dispatchs inside your application, you can prevent the default app being launched. Here's how:

void CHelloWorldAppUi::HandleForegroundEventL( TBool aForeground )
{
 if( aForeground ) // switch to the foreground
 {
  iForeground = ETrue;
  iOpenCameraKey = iEikonEnv->RootWin().CaptureKey( EKeyDevice1D, 0, 0 );
 }
 else
 {
  iForeground = EFalse;
  iEikonEnv->RootWin().CancelCaptureKey( iOpenCameraKey );
 }
}

It doesn't make sense if you capture this KeyEvent all the time, so I capture the key when my app is in foreground, release the key when my app is in background. So the default could be autostarted when this app is in backgrond.

This code is tested under P990i(UIQ 3.0)

From ZiTeng: You omitted an important information: the CaptureKey() requires SwEvent capability, that is to say an application muse be Symbian signed to use it.

  • 相关文章:
  • quote 1.chenziteng
  • inline => build-in?

    You omitted an important information: the CaptureKey() requires SwEvent capability, that is to say an application muse be Symbian signed to use it.
  • 2007-6-20 23:04:23
  • quote 2.Jimmy
  • Hi ZiTeng,

    Thank you for your comments, I've modified the title of the article and add your comments in it.
  • 2007-6-21 9:27:15
  • quote 3.钻机
  • http://www.bzdyjx.com/
  • 人生就是一个过程,起点和终点都是一样的,唯有过程不同,所以我们要更加努力去做好每一件事情,尽可能情享受人生过程的乐趣。。。
    [url=http://www.bzdyjx.com/]钻机[/url]
    [url=http://www.qilongchem.com/pages/shiyoushuzhi.htm]石油树脂[/url]
    [url=http://www.qilongchem.com/]石油树脂[/url]
  • 2008-11-19 17:16:42

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

最新留言

最近发表

Powered By Z-Blog 1.6 Final Build 60816

Copyright 2006-2007 SymbianSIG.com . All Rights Reserved.