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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


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

Re: Getting device info

[ Edited ]

.cpp --

 

 

DeviceInfo::DeviceInfo(bb::cascades::Application *app)
: QObject(app)
{
    // create scene document from main.qml asset
    // set parent to created document to ensure it exists for the whole application lifetime
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);

    // create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();
    // set created root object as a scene
    app->setScene(root);

    info = new HardwareInfo(this);


}

  

	void DeviceInfo::get()
{
imei = info->imei(); device_name = info->deviceName(); model_number = info->modelNumber(); serial_number = info->serialNumber(); qDebug() << "IMEI: " << imei << endl << "Device name: " << device_name << endl <<"Serial Number: " << device_name << endl;
}

 

 

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

Re: Getting device info

[ Edited ]
info = new HardwareInfo(this);

info is a pointer so you need to use Indirection operator ->

So you've got bugs here:

imei  = info.imei();
model_number = info.modelNumber();
serial_number = info.serialNumber();

Be carefull

Eclipse IntelliSense is very slow Smiley Wink

 

Tip: Don't forget deallocate memory in DeviceInfo destructor with delete operator

void DeviceInfo::~DeviceInfo(){
    delete info;
}

 



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

Sorry I made a mistake while replying you. I had used -> operator for calling those functions .

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

Re: Getting device info

And still doesn't work  ? Must work. Again, try Clean the whole project and Build it again. Somewhere in the code you have error, check the code.



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