Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Regular Contributor
Posts: 93
Registered: ‎08-20-2013
My Device: BB 10 -BlackBerry Z10
My Carrier: BlackBerry

Getting device info

I want to get device info like IMEI, Model,version etc.  Would you please tell me how would I get this ?

Developer
Posts: 543
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....
My Carrier: Telekom Slovakia

Re: Getting device info

[ Edited ]

This will help you
http://developer.blackberry.com/native/reference/cascades/device_and_communication_info.html



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
Regular Contributor
Posts: 93
Registered: ‎08-20-2013
My Device: BB 10 -BlackBerry Z10
My Carrier: BlackBerry

Re: Getting device info

[ Edited ]

Hello Benecore,

Thanks for your reply

As per the documentation HardwareInfo class is for getting IMEI and model . But I am having problem while creating the object of this class even after adding include file and LIBS in pro file . Giving me error

Developer
Posts: 543
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....
My Carrier: Telekom Slovakia

Re: Getting device info

What error, can you be more detailed?

BTW: If you get an error try Clean/Build project again. If does not help you, then we help you Smiley Very Happy


If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
Regular Contributor
Posts: 93
Registered: ‎08-20-2013
My Device: BB 10 -BlackBerry Z10
My Carrier: BlackBerry

Re: Getting device info

I have crteated reference of HardwareInfo in .hpp file .Its giving me this error 

'HardwareInfo' does not name a type 

 

Highlighted
Developer
Posts: 543
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....
My Carrier: Telekom Slovakia

Re: Getting device info

[ Edited ]

Are you use namespace?

bb::device::HardwareInfo info;

 or

using namespace bb::device;

HardwareInfo info;

 Part of the code where the error occurred would help Smiley Wink



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
Regular Contributor
Posts: 93
Registered: ‎08-20-2013
My Device: BB 10 -BlackBerry Z10
My Carrier: BlackBerry

Re: Getting device info

Ohh I forgot to use this . Thanks Benecore.

 

 

Developer
Posts: 543
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....
My Carrier: Telekom Slovakia

Re: Getting device info

You're welcome Smiley Wink If problem was solved mark the post as "Accept as solution"



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
Regular Contributor
Posts: 93
Registered: ‎08-20-2013
My Device: BB 10 -BlackBerry Z10
My Carrier: BlackBerry

Re: Getting device info

Now the issue is in .cpp file .  giving this error 

request for member 'modelName' in '((DeviceInfo*)this)->DeviceInfo::info', which is of non-class type 

 'bb::device::HardwareInfo*'

at every line where I have used methods to get device info .

Developer
Posts: 543
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....
My Carrier: Telekom Slovakia

Re: Getting device info

[ Edited ]

Can you please post the part of code how you use HardwareInfo?

You must doing something wrong

 

Project file:

LIBS += -lbbdevice

 bar-descriptor

<permission>read_device_identifying_information</permission>

applicationui.hpp

#include <bb/device/HardwareInfo>

using namespace bb::device;

applicationui.cpp

HardwareInfo info;

qDebug() << "IMEI: " << info.imei() << endl << \
         "DEVICE NAME: " << info.deviceName() << endl;

This must work like a charm Smiley Very Happy



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog