Sunday, July 16, 2006

Most Important 12 Sony Ericsson UIQ 3 development tips

When developing UIQ 3 C++ applications for Sony Ericsson UIQ 3 phones, the following should be considered:

  • Always favor CQikXXX classes over CEikXXX classes. Derive your AppUi from CQikAppUi (Qikon) rather than CEikAppUi .
  • Ensure that your application is “theme aware”. Use logical colors to draw application controls and propagate color scheme change messages through your application.
  • Make sure that application icons in three different sizes are defined for display on the device.
  • Prefer the Symbian exception handling before the standard C++ language exception handling.
  • Do not block a ViewActivatedL - any potentially long running action chained off a view activation should be done async. Otherwise the system may kill your application for being too sluggish.
  • Be conservative in stack usage, including the implementation of recursive algorithms.
  • Follow the UIQ 3 style guidelines.
  • Have some way to call Exit from your application in debug builds. In the emulator, this will cause a panic if there is any memory leakage. It’s much better to find memory leaks during development in the emulator, than at the end of development, when testing in the phone is done.
  • Do not run timers continuously in the background because it seriously affects battery life.
  • Make your code device independent when possible. Do not “hard code” screen sizes, colour depths, font sizes, and so on, instead use Symbian OS APIs to get details of device characteristics and capa-bilities so that your application will run on the widest possible ranges of devices including any future Symbian/UIQ based Sony Ericsson phones.
  • Avoid using local TBuf objects. They consume valuable stack space, which is extremely limited on a symbian device, and behave very differently compared to in the emulator. If you need more than a few hundred bytes allocated to a TBuf , then use a HBuf which is allocated on the Heap instead. Always remember to destroy the HBuf after it is finished with. The reasons for stack exhaustion are almost impossible to trace on the real target, they appear as random, unexplained crashes.
  • Since applications can be installed either in phone memory or on Memory Stick, avoid using absolute paths for file locations in your code.

No comments: