OEMConfig build_serial extraction

// Expert user has replied.
M Matan Genezia 1 month ago
31 1 0

Hi

In my Android app, I use UUID.randomUUID().toString() and save it to SharedPreferences

This UUID used for save information about the device in server DB

My problem is that our customer works with MDM that not update the app, but uninstall and install the new version

Therefor the UUID is changed

I need a way to extract some unique identifier of the device, that won't be change when reinstalling the app (or clear data)

 

I tried to use OEMConfig:

I tried with CallerSignature as hex & base64 as mentioned in https://developer.zebra.com/blog/generating-package-signature-use-mx (Zebra's App Signature Tools)

I tried to extract the CallerSignature with SigTools.jar

I always got the same result- CursorIndexOutOfBoundsException (index 0)

 

I added those to the manifest as well 

<uses-permission android:name="com.zebra.provider.READ"/>

<queries>
    <package android:name="com.zebra.zebracontentprovider" />
</queries>

 

Here's my code:

        val profileName = UUID.randomUUID().toString()
       val profile = "<wap-provisioningdoc>\n" +
               "  <characteristic type=\"ProfileInfo\">\n" +
               "      <parm name=\"created_wizard_version\" value=\"11.0.1\" />\n" +
               "  </characteristic>\n" +
               "  <characteristic type=\"Profile\">\n" +
               "      <parm name=\"ProfileName\" value=\"$profileName\" />\n" +
               "      <parm name=\"ModifiedDate\" value=\"2022-08-17 10:20:36\" />\n" +
               "      <parm name=\"TargetSystemVersion\" value=\"10.4\" />\n" +
               "      <characteristic type=\"AccessMgr\" version=\"10.4\">\n" +
               "          <parm name=\"emdk_name\" value=\"\" />\n" +
               "          <parm name=\"ServiceAccessAction\" value=\"4\" />\n" +
               "          <parm name=\"ServiceIdentifier\" value=\"content://oem_info/oem.zebra.secure/build_serial\" />\n" +
               "          <parm name=\"CallerPackageName\" value=\"com.supersmart.cc6000.sapir.il\" />\n" +
               "          <parm name=\"CallerSignature\" value=\"{{hex signature}}\" />\n" +
               "      </characteristic>\n" +
               "  </characteristic>\n" +
               "</wap-provisioningdoc>"

       Log.i("SERIAL", "version with hex key")
       val returnVal = arrayOf(profile)
       val profileXml = mapOf(Pair(profileName, returnVal))

       ProfileManagerBase {
           val SERIAL_URI = "content://oem_info/oem.zebra.secure/build_serial"

           val uri = Uri.parse(SERIAL_URI)
           object: AsyncTask<String, Void, Cursor>() {

               var myUri: String? = null

               override fun doInBackground(vararg params: String?): Cursor? {
                   myUri = params[0]
                   var cr = contentResolver
                   val cursor = cr.query(Uri.parse(myUri), null, null, null,null)
                   cursor?.let {
                       it.moveToFirst()
                       val serial = it.getString(0)
                       val a = serial
                       Log.i("SERIAL!!!", "doInBackground: $serial")
                   }

                   return cursor
               }
           }.execute(uri.toString())
       }
           .handleXmlProfile(profileXml, true)

 

I want to extract the build_serial (or any other data that won't be changed after reinstall)

I'm using Cc6000 Android 13

CONTACT
Can’t find what you’re looking for?