Namespaces
Variants
Actions

Find Out Cell ID in 3rd Edition

Jump to: navigation, search
Article Metadata

Article
Created: feenix (15 Mar 2007)
Last edited: hamishwillee (11 Jan 2012)


To find out the phone's current cell ID in S60 3rd Edition devices, the application must be Symbian Signed, since it requires the ReadDeviceData capability. The programmer must use an active object because the calls are asynchronous. Below is an example of a class that retrieves the Cell ID by request.

Header Required:

#include<etel3rdparty.h>

Library Required:

LIBRARY  etel3rdparty.lib

Capability Required:

Capability  ReadDeviceData

NetworkInfo.h

#ifndef __NETWORKINFO_H__
#define __NETWORKINFO_H__
 
#include <etel3rdparty.h> // CTelephony
 
// Observer interface
class MNetworkInfoObserver
{
public:
virtual void NetworkInfoRetrievedL(
const CTelephony::TNetworkInfoV1& aNetworkInfo) = 0;
virtual void HandleNetworkInfoError(TInt aError) = 0;
};
 
// Active object to get network info
class CNetworkInfo : public CActive
{
public:
static CNetworkInfo* NewL();
~CNetworkInfo();
 
void GetNetworkInfoL(MNetworkInfoObserver* aObserver);
 
protected:
// from CActive
void RunL();
TInt RunError(TInt aError);
void DoCancel();
 
private:
CNetworkInfo();
void ConstructL();
 
private:
CTelephony* iTelephony;
CTelephony::TNetworkInfoV1 iNwInfo;
CTelephony::TNetworkInfoV1Pckg iNwInfoPckg;
MNetworkInfoObserver* iObserver;
};
 
#endif // __NETWORKINFO_H__

NetworkInfo.cpp

#include "NetworkInfo.h"
 
CNetworkInfo::CNetworkInfo()
: CActive(EPriorityStandard),
iNwInfoPckg(iNwInfo)
{
CActiveScheduler::Add(this);
}
 
CNetworkInfo* CNetworkInfo::NewL()
{
CNetworkInfo* self = new (ELeave) CNetworkInfo;
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop();
return self;
}
 
void CNetworkInfo::ConstructL()
{
iTelephony = CTelephony::NewL();
}
 
CNetworkInfo::~CNetworkInfo()
{
Cancel();
delete iTelephony;
}
 
// This function is used by our class' users to start getting network info.
void CNetworkInfo::GetNetworkInfoL(MNetworkInfoObserver* aObserver)
{
__ASSERT_ALWAYS(!IsActive(), User::Leave(KErrInUse));
iObserver = aObserver;
 
// Start async call to receive current network information
iTelephony->GetCurrentNetworkInfo(iStatus, iNwInfoPckg);
SetActive();
}
 
void CNetworkInfo::DoCancel()
{
iTelephony->CancelAsync(CTelephony::EGetCurrentNetworkInfoCancel);
}
 
void CNetworkInfo::RunL()
{
User::LeaveIfError(iStatus.Int());
// Request completed successfully.
// Now we can notify our observer.
if(iObserver)
{
iObserver->NetworkInfoRetrievedL(iNwInfoPckg());
}
}
 
TInt CNetworkInfo::RunError(TInt aError)
{
// There was an error retrieving current network info.
// Let's inform our observer about the error so that it can analyze it
// and try to recover.
if(iObserver)
{
iObserver->HandleNetworkInfoError(aError);
}
 
return KErrNone;
}


Related Links

Comments

Reviewer-approved.png
17 Sep
2009
Article Review by User:Narendrachinni (20090917)

This article had explained about how to find cell id before that we have to known What is cell id You know that when you buy a new cell phone you can go to 'settings' and choose whether or not to display your number to someone you are calling. That is what is meant by showing caller ID. Yes or no, you can choose. Most young people decide to let each other know exactly who is calling, by displaying their caller ID number. We even add a thumbnail image to show up a picture of the caller, who is welcome to call us 95% of the time!

But what if the mobile caller is a trouble maker? What if it's a crank caller? A nuisance call or an idiotic prank caller who you don't really want to speak to? Aha. Now there's a little problem to sort out. Because - - they've probably disabled their 'show caller ID' function. Wouldn't you think?

You might see 'private number' showing when they call. 'Private number' means either they've disabled their 'show caller ID' function or they are calling from an overseas location.

Now if an abusive, nuisance or crank caller is really stupid - as let's face it, many are - then they might have been too emotional to remember to turn off 'show caller ID!' In this case we can catch them red-handed and investigate them. In return for their unwanted harassment and abuse, or bad taste prank - - we can obtain their full name, current address and history of addresses, and possibly even a Full Background Report! More than enough information to take to show at the local police station.

This artcle helpful to beginners


@Narendrachinni:
Cell ID is different from Caller ID, and what you are talking about is Caller ID.

@Others:
Please do not confuse between Caller ID and Cell ID. Caller ID is basically cell number, whenever you make a call your cell number is displayed on receviers cell phone. Whether to send caller ID or not, when you make a call ,is basically set by network operator. And Cell ID is the cell identity code On GSM/WCDMA networks.

The class CNetworkInfo, described in this article, is very useful to get cell ID using CTelephony API. CNetworkInfo request cell Id using asynchronous request. The callback method NetworkInfoRetrievedL() get called when asynchronous request get completed. You will get cell Id from TNetworkInfoV1 variable (i.e. aNetworkInfo.iCellId). Article is more useful to beginners.

-- 15:15, 17 September 2009 (UTC) savaj


This page was last modified on 11 January 2012, at 05:25.
143 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2012 All rights reserved