Revision as of 06:40, 23 November 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Talk:How to get my own phone number using Symbian C++

From Nokia Developer Wiki
Jump to: navigation, search

Vinnitu2 - Which code I can use?

I have C7-00 with Anna.

Which code I can use to retrieve own phone number?

I try integrate this snippet in my Qt application like:

    RTelServer telServer;
TInt n;
telServer.EnumeratePhones(n); // in my case it is 1;
TFileName tsyName;
telServer.GetTsyName(0, tsyName);
TBool isSupported = EFalse;
telServer.IsSupportedByModule(tsyName, KETelFuncMobileOwnNumberStore, isSupported); // in my case it is True
RTelServer::TPhoneInfo info;
telServer.GetPhoneInfo(0, info);
RMobilePhone phone;
phone.Open(telServer, info.iName);
RMobileONStore ownNumberStore;
RMobileONStore::TMobileONStoreInfoV1 ownStoreInfo;
RMobileONStore::TMobileONStoreInfoV1Pckg ownStoreInfoPckg(ownStoreInfo);
TRequestStatus status;
ownNumberStore.GetInfo(status, ownStoreInfoPckg);
// in my case status is KErrPermissionDenied - "an operation cannot be performed due to a potential security violation"

Why KErrPermissionDenied? What is the proper way to get phone number?

PS: to simplify i don't show check result

PSS: lets make fully working snippet!

vinnitu2 16:41, 10 November 2011 (EET)

Hamishwillee - @Vinnitu2

KErrPermissionDenied means that you don't have the right capabilities in your .Pro file. Probably NetworkServices, but it might be ReadDeviceData. If it were me, I'd try using CTelephony option first.

hamishwillee 06:17, 17 November 2011 (EET)