Thursday, July 03, 2008

How to know what all capabilities i need for my application.

This process is called "PlatSecDiagnostics" and is performed on the emulator.
Steps are
1. Edit EPOCROOT/epoc32/data/epoc.ini File
2. Check that you have this line
PlatSecDiagnostics ON.
3. Run your application with steps your application have to follow.
note: emulator will not give any error.
4. EPOCWIND.OUT from windows temp folder.
5. If you inspect EPOCWIND.OUT file you will come to know which capabilities are required.
For Example
    *PlatSec* ERROR - Capability check failed - A Message (function number=0x000000cf) from Thread  helloworld[10008ace]0001::HelloWorld, sent to Server !CntLockServer, was checked by Thread CNTSRV.EXE[10003a73]0001::!CntLockServer and was found to be missing the capabilities: WriteUserData . Additional diagnostic message: Checked by CPolicyServer::RunL
How to speedup emulator startup time.

Find and download "starer.rsc" file.

1. Search in you SDK Epoc folder for file named "sartup.rsc".
2. You will find this files in 2 places
a) Epoc32\Data\z\resource\apps
b) Epoc32\release\winscw\udeb\z\resource\apps
3. Rename both files to "sartup_backup.rsc".
4. Copy "starer.rsc" you downloaded to both folders.
5. you are ready to go.

Note: This is a hack to start emulator without a splash screen . USE IT IN YOUR OWN Risk.

Tuesday, July 01, 2008

How to auto start when application installed in memory card

You must not hard code the autostart exe path in your autostart rSC file

RESOURCE STARTUP_ITEM_INFO startexe
{
executable_name = "!:\\sys\\bin\\startexe.exe";
recovery = EStartupItemExPolicyNone;
}

How to call python module from Symbian C++

You can execute python code from Symbian C++ application ! Here's an simple example :

CSPyInterpreter* it = CSPyInterpreter::NewInterpreterL();
CleanupStack::PushL(it);
PyEval_RestoreThread(PYTHON_TLS->thread_state);

PyRun_SimpleString("open(r'c:\\foo.txt', 'w').write('hello')\n");

PyEval_SaveThread();
CleanupStack::PopAndDestroy(it);
How to create an instance of a T–class into heap with a new operator

It is possible to create an instance of a T Class with a new operator, but these precautions must be taken:

* Instances of T Classes can be safely placed into the CleanupStack, assuming that they do not contain any pointers or references to external objects. CleanupStack handles the cleanup simply by calling User::Free().

* Member variables are not zeroed automatically on construction. Only CBase’s new operator zeroes members.
How to take Control of the Call Application

RWindowGroup *pWG = &CCoeEnv::Static()->RootWin();
pWG->SetOrdinalPosition(0, 2000);
CAknInformationNote* informationNote;
informationNote = new ( ELeave ) CAknInformationNote;
TBuf16<30>message;
message.ZeroTerminate();
message.Copy(_L("Calling"));
message.Append(aNumber);
informationNote->ExecuteLD(message);
How to add any app to "Go To" for pre-v9 phones

TInt eError;
TBuf8<KMaxFileName> lBuf;
CPinbLinkBase *lBaseLnk = CPinbLinkBase::NewL(KLinkUidApplication);
CleanupStack::PushL(lBaseLnk);
lBaseLnk->SetNameL(_L("Hunter"));
lBaseLnk->SetDocumentIdIconL(EPinbUnknown);
lBaseLnk->SetParametersL(_L8("E:\\System\\Apps\\MyApp\\MyApp.app"));
lBaseLnk->SetTailParametersL();
lBaseLnk->SetLinkFileNameL(_L("C:\\system\\favourites\\MyApp.lnk"));
lBaseLnk->SetApplicationUidL(KUidMyApp);
TInt lError = lBaseLnk->ValidateLinkL();
lBaseLnk->UpdateLinkInDiskL();
CleanupStack::PopAndDestroy(lBaseLnk);


Note: Above method does not work for symbian v9.x
stats counter