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

Regular Contributor
Posts: 77
Registered: ‎01-27-2010
My Device: Dev Alpha
My Carrier: Verizon
Accepted Solution

Is there any way to get Device PIN ?

Hi, everyone


Is there any way to get a device PIN programmatically in Cascades C++? I search this forum and find this thread is talk about that but its answer can't help me. My code is here.


TestGetPin::TestGetPin(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


QString TestGetPin::getDevicePIN()
    QString pin;
    deviceinfo_identifying_details_t *deviceDetails;
    if(deviceinfo_get_identifying_details(&deviceDetails) == BPS_SUCCESS) {
        int pinValue = deviceinfo_identifying_details_get_pin(deviceDetails);
        pin = QString::number(pinValue, 16);
    qDebug() << "pin: "+pin;
    return pin;


 But console print a blank value (only "pin: "). Smiley Sad

If anyone know how to get a device PIN completely. Could you post your full code sample, please? I'll be thankful for your kindness. Smiley Happy


Posts: 217
Registered: ‎09-18-2009
My Device: Z10
My Carrier: O2

Re: Is there any way to get Device PIN ?

[ Edited ]
deviceinfo_identifying_details_t** deviceinfo_identifying_details = new deviceinfo_identifying_details_t*;
int deviceinfo_get_identifying_details_result = deviceinfo_get_identifying_details(deviceinfo_identifying_details);
if (deviceinfo_get_identifying_details_result != BPS_SUCCESS) {
    delete deviceinfo_identifying_details;
int pin = deviceinfo_identifying_details_get_pin(*deviceinfo_identifying_details);
QString pinHex = QString::number(pin, 16);
qDebug() << "pinHex: " << pinHex;


This code should do it :-)

Regular Contributor
Posts: 77
Registered: ‎01-27-2010
My Device: Dev Alpha
My Carrier: Verizon

Re: Is there any way to get Device PIN ?

Thank you very much, oliver_kranz !!  Your code is work for me .. and my old code is work too! Because I forget to set a Device Identifying permission of bar-descriptor.xml file.  



Posts: 115
Registered: ‎10-22-2012
My Device: Developer
My Carrier: Mobifone

Re: Is there any way to get Device PIN ?

Cascades have built in function to get Device PIN


Like my answer if it's helpful. Mark as answer if it help you solve the problem.