title: give runtime sms permission error in android
body: <p>I am trying to sending a message from device but whenever i am sending message from app it gives SEND sms permission error..
  it gives this error...id 10281 does not have android.permission.SEND_SMS.
   i am trying following code.</p>
  
  <pre><code>public void fetch(String cstfrom, String msg) {
      //Cursor c = database.rawQuery("SELECT * FROM " + tableName + " where Category = '" +categoryex + "'" , null);
      String query = "SELECT mobile FROM employee WHERE empcst ='" + cstfrom + "' ";
      database = dbHelper.getReadableDatabase();
      Cursor cursor = database.rawQuery(query, null);
      while (cursor.moveToNext()) {
          itemname = cursor.getString(cursor.getColumnIndex("mobile"));
          Toast.makeText(this, itemname, Toast.LENGTH_SHORT).show();
          final int PERMISSION_REQUEST_CODE = 1;
  
          if (android.os.Build.VERSION.SDK_INT &gt;= android.os.Build.VERSION_CODES.M) {
              if (checkSelfPermission(Manifest.permission.SEND_SMS)
                 == PackageManager.PERMISSION_DENIED) {
  
                  Log.d("permission", "permission denied to SEND_SMS - requesting it");
                  String[] permissions = {Manifest.permission.SEND_SMS};
  
                  requestPermissions(permissions, PERMISSION_REQUEST_CODE);
                  SmsManager sms = SmsManager.getDefault();
                  sms.sendTextMessage(itemname, null, "hiii", null, null);
  
              }
          }
      }
      cursor.close();
  }
  </code></pre>