You Are Here:

Community: Wiki

This page was last modified 11:45, 10 June 2007.

How to get my own phone number

From Forum Nokia Wiki



NOTE

The source of this information is Symbian's FAQ-0970 but a key information from that article is missing: the sample code provided below is intended for "Symbian OS 7.0 (and later) Binary Access Kit / DevKit licensees".

What that basically means is that the APIs used are not public and can only be accessed through Symbian's partnership programs. It also means that a S60 developer using the public SDK cannot effectively apply this solution for accessing the own number from their code. Since the API is owned by Symbian it is also not accessible through Forum Nokia's S60 API Partnering program.

Bottom line, the solution described in this article is useless for most of the developers that are using this wiki.

Please take this article as an example and try to make sure that the articles you are contributing to are:

  • based on publicly available official information
  • using only public APIs


Forum Nokia reserves the right to suspend or remove articles that contain confidential information or make use of internal APIs.


How to get my own phone number (eventually)

void RMobileONStore::Read(TRequestStatus& aReqStatus, TDes8& aEntry)

This API is being used to get the own phone number:

// Requirement: etel server, tsy, have been opened and initialized

TBool isSupported = EFalse;
User::LeaveIfError(telServer.IsSupportedByModule(tsyName, KETelFuncMobileOwnNumberStore, isSupported));
 
if (isSupported != EFalse)
{
console->Printf(_L("Own number store is supported.\n"));
}
else
{
User::Leave(KErrNotSupported);
}
 
TInt numPhones=0;
telServer.EnumeratePhones(numPhones);
 
for (TInt i=0; i<numPhones; i++)
{
TRequestStatus status;
RTelServer::TPhoneInfo info;
telServer.GetPhoneInfo(i, info);
 
RMobilePhone phone;
User::LeaveIfError(phone.Open(telServer, info.iName));
CleanupClosePushL(phone);
 
RMobileONStore ownNumberStore;
User::LeaveIfError(ownNumberStore.Open(phone));
CleanupClosePushL(ownNumberStore);
 
// Check if there is own number entry stored.
RMobileONStore::TMobileONStoreInfoV1 ownStoreInfo;
RMobileONStore::TMobileONStoreInfoV1Pckg ownStoreInfoPckg(ownStoreInfo);
 
ownNumberStore.GetInfo(status, ownStoreInfoPckg);
User::WaitForRequest(status);
 
if(status.Int() == KErrNone)
{
CheckCapabilities(ownStoreInfo.iCaps);
 
if(ownStoreInfo.iUsedEntries < 1)
{
console->Printf(_L("No entry found.\n"));
User::Leave(KErrNotFound);
}
}
else
{
User::Leave(status.Int());
}
 
// Read the own number entry
status = KRequestPending;
RMobileONStore::TMobileONEntryV1 ownNumberEntry;
ownNumberEntry.iIndex = 1;
RMobileONStore::TMobileONEntryV1Pckg ownNumberEntryPckg(ownNumberEntry);
 
ownNumberStore.Read(status,ownNumberEntryPckg);
User::WaitForRequest(status);
 
if (status.Int() == KErrNone)
{
console->Printf(_L("\nOwn number = %S"), &ownNumberEntry.iNumber.iTelNumber);
}
else
{
console->Printf(_L("\nNO Own number: error %d"), status);
}
 
CleanupStack::PopAndDestroy(2); // i-th phone & ownNumberStore;
}


Alternatively, you may be able to use a helper class CRetrieveMobilePhoneONList if the target device supports KCapsWholeStore capability. The following code snippet illustrates an example usage.

#include <mmretrieve.h>
 
// Precondition server, phone module and phone have been opened
 
RMobileONStore ownNumberStore;
User::LeaveIfError(store.Open(phone));
CleanupClosePushL(ownNumberStore);
 
RMobilePhoneBookStore::TMobilePhoneBookInfoV1 storeInfo;
RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg storeInfoPckg(storeInfo);
store.GetInfo(status,storeInfoPckg);
User::WaitForRequest(status);
 
if(status == KErrNone)
{
if(storeInfo.iCaps & RMobilePhoneStore::KCapsWholeStore)
{
console->Printf(_L("KCapsWholeStore supported"));
}
else if (storeInfo.iCaps & RMobilePhoneStore::KCapsIndividualEntry )
{
console->Printf(_L("KCapsIndividualEntry supported"));
}
}
 
CRetrieveMobilePhoneONList* retrieve;
retrieve=CRetrieveMobilePhoneONList::NewL(ownNumberStore);
 
retrieve->Start(status);
User::WaitForRequest(status);
 
CMobilePhoneONList* onList=NULL;
TInt error=KErrNone;
TRAP(error, onList=retrieve->RetrieveListL();)
 
TInt numOfEntry = 0;
if (error == KErrNone)
{
numOfEntry = onList->Enumerate();
}
 
RMobileONStore::TMobileONEntryV1 entry;
for (TInt index=0; index < numOfEntry ; index++)
{
error = KErrNone;
TRAP(error, entry = onList->GetEntryL(index))
if (error == KErrNone)
{
console->Printf(_L("Own Number %S\n"), entry.iNumber.iTelNumber);
}
else
{
console->Printf(_L("Read error!!"));
}
}
 
//Close the phone and the mobileStore and remove them from the cleanup stack
CleanupStack::PopAndDestroy(2);


--

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditFurlTechnocratiMagnoliaTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fMMPE5ffileX qdcZpublisherQUxhttpE3aE2fE2fswE2enokiaE2ecomE2fidE2fc764fd1cE2d8b06E2d499aE2d9a6aE2d17c3903d5a65E2fforumE5fnokiaE5fcrawlerE5fagentX qdcZtitleQSxMMPE20fileE20E2dE20ForumE20NokiaE20WikiX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfnTypeZCommunityContentQ qdcZtypeQUqfnTypeZE52esourceQ qdcZtypeQUqfnTypeZWebpageQ qdcZtypeQUqfnTypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qrssZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qfnZdistributionQUxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2fX qfnZtypeQUqfnTypeZCommunityContentQ qfnZtypeQUqfnTypeZE52esourceQ qfnZtypeQUqfnTypeZWebpageQ qfnZtypeQUqfnTypeZWikiContentQ qfnZupdatedQDx2008E2d10E2d02X qfnZuserE5ftagQSxfileX qfnZuserE5ftagQSxlibpathX qfnZuserE5ftagQSxmmpX qfnZuserE5ftagQSxresourceX qmarsZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfnTypeZCommunityContentQ qrdfZtypeQUqfnTypeZE52esourceQ qrdfZtypeQUqfnTypeZWebpageQ qrdfZtypeQUqfnTypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ