Getting java.lang.SecurityException when requesting for SIM info
<p>I am trying to make an app that gives one the Sim card number, IMEI number and phone number. However when I do it I get the following error:</p>

<pre><code> java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.hadi.sim_info/com.example.hadi.sim_info.MainActivity}: java.lang.SecurityException: getLine1NumberForDisplay: Neither user 10034 nor current process has android.permission.READ_SMS
</code></pre>

<p>I have written the permission in the manifest:</p>

<pre><code>&lt;uses-permission android:name="android.permission.READ_PHONE_STATE"/&gt;
</code></pre>

<p>Here is my code for the app:</p>

<pre><code>public class MainActivity extends AppCompatActivity {

    TextView tlf, sim, IMEI;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        tlf = (TextView) findViewById(R.id.Tlf_nr);
        sim = (TextView) findViewById(R.id.sim);
        IMEI = (TextView) findViewById(R.id.IMEI);

        TelephonyManager tm = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
        String number = tm.getLine1Number();
        String simNR = tm.getSimSerialNumber();
        String IMEINR = tm.getDeviceId();

        tlf.setText("Tlf. Nr.: "+number);
        sim.setText("SIM Nr.: "+simNR);
        IMEI.setText("IMEI Nr.: "+ IMEINR);
    }
}
</code></pre>

<p>EDIT:</p>

<p>This is my manifest:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest package="com.example.hadi.sim_info"
          xmlns:android="http://schemas.android.com/apk/res/android"&gt;

    &lt;uses-permission android:name="android.permission.READ_PHONE_STATE"/&gt;

    &lt;application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"&gt;
        &lt;activity android:name=".MainActivity"&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN"/&gt;

                &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
    &lt;/application&gt;

&lt;/manifest&gt;
</code></pre>