언어 설정

Menu
Sites
Language
How to get local IP address in emulator?

Hi,

I am trying to get local address of device in Tizen emulator. I have tried this

const NetConnectionInfo* netInfo = Tizen::Net::NetConnectionInfo();
const IpAddress *pIp4Address = netInfo->GetLocalAddress();

But got nothing. Also tried this

NetAccountManager netAccountManager;
result r;
r = netAccountManager.Construct();
NetAccountId accountId = netAccountManager.GetNetAccountId(NET_BEARER_PS);
NetConnection* pNetConnection = new NetConnection();
r = pNetConnection->Construct(accountId);
r = pNetConnection->AddNetConnectionListener(*this);
r = pNetConnection->Start();
const IpAddress* ipAddress = pNetConnection->GetNetConnectionInfo()->GetLocalAddress();

But in this case, 'pNetConnection->Start()' returns 'E_PRIVILEGE_DENIED'. If anyone can help me to know what I am missing or how to fix this problem, it'll be helpful.

Thanks.

Responses

4 댓글
harish kumar kavali

Add the following privilege in your manifest file privileges tab
http://tizen.org/privilege/network.connection

 

Raisa Islam Nidha

I saw that earlier but I have no clue how to add this. If you could tell exactly how to this, it will be highly appreciated.

Alex Dem

Hi,
https://developer.tizen.org/dev-guide/2.2.1/org.tizen.native.appprogramming/html/app_dev_process/setting_app_manifest.htm
and edit 'Privileges' tab.
Alexey.

Raisa Islam Nidha

It's working. Thanks.