title: Can't get IMEI as device owner on Android 10
body: <p>For a special kiosk setup I need the IMEI of the device. Since Android 10 it is not possible for regular apps to access device identifiers like the IMEI. However the <a href="https://developer.android.com/reference/android/telephony/TelephonyManager#getImei(int)" rel="nofollow noreferrer">documentation</a> suggests:</p>
  
  <blockquote>
    <p>This API requires one of the following:</p>
    
    <ul>
    <li>If the caller is the device or profile owner, the caller holds the Manifest.permission#READ_PHONE_STATE permission.</li>
    <li>...</li>
    </ul>
  </blockquote>
  
  <p>I've set the app as device owner with the following command:</p>
  
  <pre><code>adb shell dpm set-device-owner com.xxxx.xxxx/.AdminReceiver
  </code></pre>
  
  <p>My manifest contains:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
  </code></pre>
  
  <p>The IMEI is accessed with the following lines of code:</p>
  
  <pre><code>TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
  
  try
  {
      return telephonyManager.getImei();
  }
  catch (SecurityException e)
  {
      return null;
  }
  </code></pre>
  
  <p>I'm still getting SecurityExceptions (with message: <code>The user does not meet the requirements to access device identifiers.</code>). What am I doing wrong?</p>