Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. I need to get a serial number of device
Forum Updated to NodeBB v4.3 + New Features

I need to get a serial number of device

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
5 Posts 4 Posters 3.6k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zealot2
    wrote on last edited by
    #1

    Good day for all. Sorry any error on my english, but, my natural language is spanish. I have started to program in qt target to android early, then I have a personal project that need to get a serial number of the device, any cell or table. The problem is that I don't have idea about how to do that. Thanks any suggestion or advise.

    Pablo J. RoginaP 1 Reply Last reply
    0
    • Z zealot2

      Good day for all. Sorry any error on my english, but, my natural language is spanish. I have started to program in qt target to android early, then I have a personal project that need to get a serial number of the device, any cell or table. The problem is that I don't have idea about how to do that. Thanks any suggestion or advise.

      Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @zealot2 what about this? Please note this is Java code (place it in your Android activity)::

       public static String getDeviceId(Context context) {
          final String deviceId = ((TelephonyManager)
      context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
          if (deviceId != null) {
              return deviceId;
          } else {
              return android.os.Build.SERIAL;
          }
      }
      

      taken from here

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      Aleksey_K 0A 1 Reply Last reply
      0
      • GTDevG Offline
        GTDevG Offline
        GTDev
        wrote on last edited by
        #3

        You can also have a look at V-Play Engine, which offers to access device information such as model identifier or a unique device id.

        Senior Developer at Felgo - https://felgo.com/qt

        Develop mobile Apps for iOS & Android with Qt
        Felgo is an official Qt Technology Partner

        1 Reply Last reply
        0
        • Pablo J. RoginaP Pablo J. Rogina

          @zealot2 what about this? Please note this is Java code (place it in your Android activity)::

           public static String getDeviceId(Context context) {
              final String deviceId = ((TelephonyManager)
          context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
              if (deviceId != null) {
                  return deviceId;
              } else {
                  return android.os.Build.SERIAL;
              }
          }
          

          taken from here

          Aleksey_K 0A Offline
          Aleksey_K 0A Offline
          Aleksey_K 0
          wrote on last edited by
          #4

          @Pablo-J.-Rogina how to call this from Qt C++ application?

          Pablo J. RoginaP 1 Reply Last reply
          0
          • Aleksey_K 0A Aleksey_K 0

            @Pablo-J.-Rogina how to call this from Qt C++ application?

            Pablo J. RoginaP Offline
            Pablo J. RoginaP Offline
            Pablo J. Rogina
            wrote on last edited by
            #5

            @Aleksey_K-0 you may want to take a look at QAndroidJniObject class, and also check this question in stackoverflow

            Upvote the answer(s) that helped you solve the issue
            Use "Topic Tools" button to mark your post as Solved
            Add screenshots via postimage.org
            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            1

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved