Important: Please read the Qt Code of Conduct -

How to get unique id(like product id, imei,..) from mobiles, tablets, ipad's using qt?

  • I'm trying to get the unique key for mobile devices(ios, android). I first tried jni method for android call Telephony Manager from java but it fails, Is there any ways to find the unique that may be of any kind but unique for every devices.
    This the method i used

        private String id()
            System.out.println("device id....");
            TelephonyManager mTelephonyMgr;
            mTelephonyMgr = (TelephonyManager)
                System.out.println("getting device id...."+mTelephonyMgr.getDeviceId());
                return mTelephonyMgr.getDeviceId();

    but it fails to return one the first time i call this function it didn't give ant reply when i call it next time the app crashes with the error: art/runtime/] JNI DETECTED ERROR IN APPLICATION: JNI NewString called with pending exception 'java.lang.RuntimeException' thrown in unknown throw location.

    Help me to found some methods that to get the unique id's.

  • Lifetime Qt Champion


    The QtSystems module might be what you need. However I'm not sure whether the mobile targets are already supported.

    Hope it helps

  • @SGaist Thanks for your suggestion.
    I did some minor mistake. The above method i used had some instance creation problem. Now the telephonyManager works fine get IMEI using JNI for android devices. But for ios i'm not able to get IMEI.
    And i also ref QtSystems module but it may seems that only support for Linux, Windows, mac devices not for mobile platforms...
    Suggest some concepts for ios mobiles and ipad that works same like jni used for android.
    Hope to solve this.

  • It is not possible for iOS. You should consider using user authorization.

  • Lifetime Qt Champion

    This article explains the various options you have.

Log in to reply