Marshmallow get Imei natively with service call
<p>I need to get the Imei from a Galaxy S6 with native code!
I don´t can use Java-Code for it.</p>

<p>In Lollipop i Use </p>

<pre><code>char *res = exec_get_out((char *) "service call iphonesubinfo 3");
</code></pre>

<p>to get IMEI and other characters, where i extract the Imeinumber.</p>

<p>Now with Marshmallow the new Permissions was released. I implemented It.
And i can get the imei like below with javacode.</p>

<pre><code>if (ContextCompat.checkSelfPermission(this,
            Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED)
    {
        requestPermissions(new String[]{Manifest.permission.READ_PHONE_STATE}, 123);
    }

    String test = ((TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
</code></pre>

<p>But when I want to get the Number with the old native method i get the following result.</p>

<pre><code>&gt;null from uid 10169 not allowed to perform OP_READ_PHONE_STATE
</code></pre>

<p>I tried the "service call iphonesubinfo 3" command in adb shell and it gaves me the old result. But not in native Code.</p>

<p>Has anyone an Idea to solve this problem ?</p>