Tuesday, January 27, 2009

Symbian Naming Conventions

Correct Symbian vaiable naming:
i-prefix for member variables
a-prefix for method parameters.
C-prefix for classes that should be constructed on the heap.
T-prefix for classes that can fit on the stack.
L-postfix for methods that can leave.

Thursday, January 15, 2009

Nokia's QT Every Where

Thursday, October 30, 2008

How to detect if phone has 3G enabled.

Some items in you applications you want to do some action only when there is 3G network (like video streaming upload or video calling.) So how to detect that phone has 3G network.
TBool isSupported = CFeatureDiscovery:: IsFeatureSupportedL (KFeatureIdProtocolWcdma);
if (isSupported)
// activate the service

Saturday, October 25, 2008

How to know current editing state of TextEditor.

You can use CAknEnv::EditingStateIndicator() to get then current editing starts.
code below show how to know if T9 is On or OFF.
TBool t9_mode;
MAknEditingStateIndicator* editingindicator = CAknEnv::Static()->EditingStateIndicator();
CAknIndicatorContainer* indicatorcontainer =editingindicator->IndicatorContainer();
if (indicatorcontainer->IndicatorState(TUid::Uid(EAknNaviPaneEditorIndicatorT9)))
t9_mode = ETrue;
t9_mode = EFalse;

Tuesday, October 21, 2008

How to fource application to use AGPS instead of GPS.

Solution is you have circle through all the gps modules avaialble and select one with AGPS Support.
RPositionServer iPosServer;
RPositioner iPositioner;


for(TInt i = 0 ; i < moduleCount ; i++)
TPositionModuleInfo modInfo;
TInt error = iPosServer.GetModuleInfoByIndex( i, modInfo );
if(modInfo.IsAvailable() && (modInfo.TechnologyType() == TPositionModuleInfo::ETechnologyAssisted))
How to get UserAgent for S60 v3.x devices.

use the following code to get the user agent of the device.

iRepository= CRepository::NewLC(TUid::Uid(0x101f8731));
TBuf<255> tmp;
iRepository->Get(7, tmp);
iUserAgent = HBufC8::NewL(tmp.Length());
How to make old sdk installations foot-print disappear.

Problem: some times the emulator or my sdk [v3.0 MR] installation gets corrupted due to prolonged usage. and i want to reinstall so i uninstall the SDK and reinstall it but the new installation takes S60_3rd_MR_2 as epoc path so how to default it to S60_3rd_MR.

1. Uninstall S60_3rd_MR from you PC and delete S60_3rd_MR folder.
2. Open RegEdit
3. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Nokia\com.nokia.s60 and check the counter value
4. if the counter value not "0" then set it to 0.
5. restart PC and install S60_3rd_MR again.

Wednesday, October 01, 2008

How to observe the flip open and flip close event

If you wanted to observe the flip open and flip close event in case of N93. then you have to use EnableScreenChangeEvents and try capturing events EEventCaseClosed, EEventCaseOpen in RunL()

if(iStatus == KErrNone)
TWsEvent e;
case EEventCaseClosed:
case EEventCaseOpen:

Taking ScreenShot in Symbian

Below are steps we have to take ScreenShot and saving it to the file as .jpeg.

1.Create blank bitmap:
iBitmap = new (ELeave)CFbsBitmap;
iBitmap->Create( TSize(176,208),EColor16M ); // Pass the Window Size to capture

2.Create a rectangle of the window you want to capture:
iScreenRect = TRect(TPoint(0,0),TSize(176,208)); // Pass the Window Size to capture

3. Copy Screen To this bitmap and save it into memory.

4. Now we have to Encode CFbsBitmap to JPEG Format.

TBuf<50> myBuf;

iEncoder = CImageEncoder::FileNewL(iFsSession, myBuf, CImageEncoder::EOptionAlwaysThread, KImageTypeJPGUid);

TRequestStatus status;

5. The conversion process is asynchronous. When it is completed, RunL() is called. Inside RunL()

Indside RunL():
delete iEncoder;
iEncoder = NULL;
How to simplify Symbian Classes using Template.

As you all know we have to have 2-Phase consutsction in heap based classes. And also know that it's repetitive code that we have to write for each and every classes. If you can minimize the coding effort that will help us in long run, for that we can use the Symbian Templates.

Define a class which is base class

// baseclass.h
#ifndef __BASE_CLASS_H__
#define __BASE_CLASS_H__

template <class T>
class CBaseClass : public CBase
static T* NewL(RWsSession& aWsSession)
T *self = T::NewLC(aWsSession);
return self;

static T* NewLC(RWsSession& aWsSession)
T *self = new (ELeave) T(aWsSession);
return self;

virtual void ConstructL() = 0;

Now We can use in any class like below

#ifndef __MYCLASS_H__
#define __MYCLASS_H__

#include "baseclass.h"
class CMyClass;
class CMyClass : public CBaseClass<CMyClass>
void ConstructL();
note: you can improve the above implemetaion as per your requirement.
How to Copy BitMap Object to BitMap Object

We can load a bit map using CEikonEnv::CreateBitmapL()
CFbsBitmap* myBitmap = iEikonEnv->CreateBitmapL(KBmpPath,index);

Code below shows how to copy BitMap
CFbsBitmap* aBitmap = new (ELeave)CFbsBitmap;
TRect tempRect(TPoint(0,0),myBitmap->SizeInPixels() );
TInt iBufLength = tempRect.Width() * tempRect.Height() * 2;
How to choose a mobile platform

When it comes to choosing the target platform and technology for your mobile project the possibilities are numerous. There are several kinds of PDAs and mobile phone platforms to choose from, and they all have somewhat different characteristics. You'll consider very different factors when you develop applications for the Pocket PC versus the Palm OS, even though their target markets are nearly the same. On the other hand, using Mobile Information Device Profile (MIDP) for application development is quite different from doing it using Symbian, even though these two platforms tend to target the same devices.

Project scope and limitations

Before you even begin to consider technology platforms and target devices, you must have a crystal-clear picture of the software you're developing. To begin, ask yourself these questions:

* Who is your target audience? Is your application intended for consumer use, or will it be used more in business or corporate environments? Consumer devices are generally different from business devices, so knowing your target audience will help you narrow down your target device -- quickly. You won't get far developing a children’s game for the Pocket PC.
* Are you developing a game or an application? If it's a game, consider the demographics of the people who will play it (age, gender, economic bracket, and so on). That will give you an idea of which consumer devices to target.
* Are there any pre-existing requirements? If your distributor only handles Symbian applications, for example, then your choice is easy. Likewise if you're developing a business app for a company that already has Symbian phones in place.
* What's your skill-set? Assuming you're doing the coding, if you're a Java™ developer then you probably want to stick with the Java platform (unless you have a good reason for switching to some other technology).
* How quickly do you need the application or prototype? Some technology solutions add complexity, and thus development time, to a project, whereas others limit both.
* How much money do you have? Money is almost always the most important factor to consider.

While not so integral to choosing your development platform, it's also a good idea to know what niche your application will fall into. Is it unique enough to dominate the market on any target device, or will it be one application among many in a given genre? These considerations will help you decide how much time and money to invest in your application, as well as what kind of returns you can anticipate.

Mobile technology options

Mobile development technologies have quite a range -- from the stripped-down server-side scripting of Short Message Service (SMS) to the complete development platforms of Symbian and MIDP. Before I get into comparing the technologies most commonly used for mobile development, I'll briefly describe each one and discuss its pros and cons from both a development and a market perspective.

SMS (Short Message Service) and MMS (Multimedia Service) are by far the simplest technologies to use for mobile development. Both build on the basic functions of mobile phones, with the SMS/MMS development happening on the server side. The simplest way to make an SMS application (for example one that receives a message and sends a joke) is to sign a contract with a mobile service operator and write a simple PHP script that communicates with the operator's interface. MMS applications are the same but a bit more complicated, because you're handling different kinds of content.
The Mobile Information Device Profile (better known as mobile Java) launched the mobile application revolution. Sadly, the technology fell flat of many developer's expectations when it turned out that its applications weren’t really write-once, run-everywhere. MIDP 2.0 fixed many of the problems inherent in the first version, but some developers still have doubts about MIDP. On the upside, MIDP development can be very fast, allowing you to make a working application or prototype in just a few days.
Symbian is an increasingly popular operating system for smart phones. Symbian has a number of user interface platforms, including Nokia’s Series 40, Series 60, Series 80, and Series 90, and the UIQ, which is used by Sony Ericsson and Motorola among others. Symbian is a lot more complicated to work with than MIDP, but Symbian applications are designed and targeted for a particular UI and platform, making them more reliable. Symbian applications are written mainly in C++.
Pocket PC
Windows™ CE, Pocket PC Edition (aka Pocket PC or Windows mobile) is Microsoft’s operating system for PDAs. The Pocket PC platform resembles other Windows operating systems, which makes it quite easy to learn. A Pocket PC device also contains all the basic applications for word processing, personal information management, e-mail, and so on, making it a popular choice among consumers. On the other hand, Pocket PC devices don’t necessarily have network connections or phone functions. Pocket PC apps are typically written in C++, Visual Basic, or the Java language.
Smartphone is the smartphone version of Windows CE or Windows Mobile. It is aimed at smartphones and mainly competes in the same category as the Symbian OS. Smartphone development is similar to Pocket PC development. Because Smartphone is a mobile phone platform it is guaranteed to have phone functions and connectivity.
Palm OS
Palm OS is the operating system behind Palm devices, which were among the first practical handheld devices. These days there are Palm OS phones and PDAs. Palm devices have a loyal user base, which ensures a good market for Palm applications. Palm OS Garnet and Palm OS Cobalt are the two versions of the Palm platform, Cobalt being the newer version. Most Palm OS applications are written in C, but there are development environments that will let you create Palm OS applications in other languages including C++, Visual Basic, or Java programming.
iPhone, Android, Linux etc

Now you have a clear sense of your application and the mobile technologies you could use to build it, but you're probably not sure yet which is the best one. Asking more questions (and answering them) will help you narrow the decision down even further.

What can you afford?

Money is the bottom line in application development. Knowing what you have to spend lets you determine how much time you have to develop your application and how many developers you can assign to the project. Symbian is probably the slowest and, thus, most expensive mobile development technology, while MIDP, Pocket PC (with Visual Basic), and SMS can be quite fast and cheap. Table below summarizes the budgeting considerations for each of the mobile development technologies profiled.

Budget factors compared
TechnologyBudgeting considerations
SMS and MMSYou can use standard Web development tools, like Java programming or PHP, and you'll find plenty of experienced developers. It's also easy to learn these technologies yourself. You'll need a Web host for your scripts and a contract with your local mobile operator.
MIDPDevelopment tools are free, although some of the commercial tools can make development faster and easier. The MIDP APIs are quite easy to learn and use. You can build a good application with a small team.
SymbianProbably the most difficult to master, and thus expensive, but also rewarding. The software is reliable and has a solid reputation. Consumers are willing to pay more for Symbian. You will need a commercial development tool, which adds to the cost. Further, some distributors only accept tested applications, so you’ll have to use a third-party testing company to do the testing. And in the latest version of Symbian, you have to get your applications signed.
Pocket PCFree tools let you start a development project with a small budget. Developing an application with a reasonable amount of features requires experience and time, however, as with any other Windows application.
SmartphoneDevelopment is pretty straightforward if you’re familiar with Microsoft’s technologies and are fluent with Visual C++. You'll find a large community of experienced developers for Microsoft’s technologies, so the size of the team will depend on the size of your project.
Palm OSYou can download free development tools from Palmsource and get support for a small fee. Palm OS development is about as demanding as Windows Mobile (Pocket PC and Smartphone) development, with the same benefits and constraints.

How much time do you have?
Table below shows the factors that affect development time for each mobile technology, then categorizes them by speed. (Of course, a lot depends on the experience of the development team.)

Development time factors compared
TechnologyFactors that affect development timeSpeed
SMS and MMSGetting the contracts with a mobile operator can take some time, but the development itself should go quickly if you're an experienced Web developer.Fast
MIDPPrototypes can be made very quickly. A simple application can be designed, implemented, and tested in a month. Fast
SymbianWhile this is the most time-consuming choice, it significantly increases the credibility of your application. You most likely need a development team that is experienced with Symbian. If you plan to learn the technology yourself make sure you reserve enough time.Slow
Pocket PCVisual Basic development is quite fast even for the beginner, but C++ development takes time. You can also use the Java platform, but doing so presents limitations for running the application easily in the device.Medium
SmartphoneQuite like the Pocket PC. Medium
Palm OSDeveloping with C is slow compared to MIDP. Other options are faster.Slow

What's the ROI?

Not all people who own certain devices are potential buyers. Some don’t even know that their mobile phone is Java-enabled -- or even know what "Java-enabled" means. Knowing what to expect in returns will help you decide how much time and money to put into your application up front; this is an important consideration for some mobile platforms. Table 3 describes the potential market for different platforms and explains some of the variables that will affect your application's return on investment.

ROI and target consumers compared
SMS and MMSNearly everyone with a mobile phone is a potential user of SMS or MMS services, although you'll find more users in some demographics than others. Stock market applications are strictly for business people, whereas almost anyone could want to vote for their favorite reality television series candidate.
MIDPMost mobile phones now include MIDP 2.0, but that doesn’t mean that consumers know what to do with it. As a test, ask all your friends and family if their phones are Java-enabled. How many of them know that they have Java-enabled phones? How many of them have used a mobile Java application?
SymbianAt the moment there are two market segments for Symbian: young people for games and business people for business apps. More users will tune into Symbian soon, but for now these are the early adopters who are willing to pay for applications.
Pocket PCThese devices are mostly owned by business people, which guides the applications built for them. Think PIM applications, travel applications, and the like.
SmartphoneSmartphone is relatively new (compared to Palm OS, for example) and so its market is quite fresh. There are not very many devices out yet, but the number is growing. The phones are quite large, so, at the moment it's unlikely to woo the masses.
Palm OSThe PDA's target audience is mainly business people or people with a high demand for contact and memo data. The phones could appeal to anyone, but their size and price suggests that they're targeted to business people or early adopters.

In conclusion

I've focused in this column on considerations to help you choose the right mobile platform, starting with some questions to help you define your software project. Knowing the scope and limitations of your application -- from both a development and a market perspective -- is paramount in choosing the right technology to build it. From there, you'll want to consider market factors such as whether your application falls into a niche that is already dominated by a given technology or range of devices and the anticipated return on investment from your app. Finally, think about the development itself.

Developing MIDP apps is relatively simple and takes place entirely on the Java platform. If you're building a lightweight consumer app and you know Java already, then MIDP is a good choice for you. If you want to build your application using Symbian -- a good choice for more robust applications that will compete for marketshare -- then you or your team must be proficient in C++ programming. An SMS application is easy to build and can target a wide audience, but offers a fairly limited user interface.

The key to choosing the right technology for your projects is to think from multiple perspectives. Here, I've introduced the most commonly used mobile technologies and compared them based on the three essential considerations for any project: budget, development time, and ROI.

Friday, September 12, 2008

Why Should we use Resource Files in defining UIs ?

Symbian (and its Licensees S60 and UIQ) provides a lot of the infrastructure for an application in Symbian.C++ that is already prebuilt[like MFC] so it is not really practical to reinvent the wheel with more code to rebuild the controls.

Additionally to provide a consistent framework across devices, the underlying OS uses a framework calls LAF which dictates how controls should look and where they should be on the screen so that there is a common style to all applications.

Also Keeping source code and resource files separate, which gives lots of advantages
1. easy localization,
2. developer only need to recompile resource files if there are any changes in the UI elements.
stats counter