title: Android android.permission.SEND_SMS does not work properly
body: <p>I am trying to create an app for my personal use. I want to send message to one number when by bettery percentage goes below 5%.</p>
  
  <p>I am getting the battery level and trying to send SMS using SmsManager like below.</p>
  
  <pre><code>private void getBatteryPercentage() {
      BroadcastReceiver batteryLevelReceiver = new BroadcastReceiver() {
          public void onReceive(Context context, Intent intent) {
              context.unregisterReceiver(this);
              int currentLevel = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
              int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
              int level = -1;
              if (currentLevel &gt;= 0 &amp;&amp; scale &gt; 0) {
                  level = (currentLevel * 100) / scale;
              }
              batteryPercent.setText("Battery Level Remaining: " + level + "%");
              //if(level&lt;=5 &amp;&amp; notSent){
              //    notSent=false;
              //   SmsManager smsManager=SmsManager.getDefault();
              //  Log.d("Sending message to", "9999999999");
              //   smsManager.sendTextMessage("9999999999",null,"Battery percent: "+level+"%",null,null);
              // }
          }
      };
      IntentFilter batteryLevelFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
      registerReceiver(batteryLevelReceiver, batteryLevelFilter);
  }
  </code></pre>
  
  <p>The problem is when I comment the Message part, it works fine and shows the battery percentage. But if i un-comment that part and try to send message i get the following error.</p>
  
  <pre><code>      09-02 17:03:06.795  12849-12849/com.example.karthik.lowbattery E/AndroidRuntime﹕ FATAL EXCEPTION: main
        Process: com.example.karthik.lowbattery, PID: 12849
        java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.BATTERY_CHANGED flg=0x60000010 (has extras) } in com.example.karthik.lowbattery.MyActivity$1@4517e460
  
  
  
        Caused by: java.lang.SecurityException: Sending SMS message: uid 10268 does not have android.permission.SEND_SMS.
        at android.os.Parcel.readException
  </code></pre>
  
  <p>But actually i have permission to send SMS.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.karthik.lowbattery" &gt;
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="21" /&gt;
  
      &lt;uses-permission android:name="andriod.permission.SEND_SMS"/&gt;
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name=".MyActivity"
              android:label="@string/app_name" &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>
  
  <p>Can somebody tell me what is wrong with my code?
  Thank you :)</p>