title: How to give run time permission for marshmallow for read SMS from inbox in eclipse
body: <p>I have applied multiple code but it's show me checkSelfPermission() and shouldShowRequestPermissionRationale methods not exits, please help me..</p>
  
  <p>I used brodcast receiver class for reading SMS it's working fine for jellybean to lolipop but not for marshmallow and lower versions than jellybean like icecream sandwitch, how can i make application to compatible for all android versions,</p>
  
  <p>please guide me step by step because i'm new for this and please give me example also.</p>
  
  <p>hear is my code for read sms permission..</p>
  
  <pre><code>public void getpermission(){
  
  
      // Here, thisActivity is the current activity
      if (ContextCompat.checkSelfPermission(MainActivity,
                      Manifest.permission.READ_SMS)
              != PackageManager.PERMISSION_GRANTED) {
  
              ActivityCompat.requestPermissions(thisActivity,
                      new String[]{Manifest.permission.READ_SMS},
                      REQUEST_CODE_ASK_SINGLE_PERMISSION);
  
              // REQUEST_CODE_ASK_SINGLE_PERMISSION is an
              // app-defined int constant. The callback method gets the
              // result of the request.
          }
      }
  </code></pre>