title: Android - how to make my app default sms app programatically
body: <p>I am developing an sms blocking app. Which is working fine up to Jelly-Bean. And its not working from Kitkat to Marshmallow. I searched on google and everyone recommending to take permission from user to make it default sms app of this phone by using . </p>
  
  <pre><code>   if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.KITKAT) {
                  if(!Telephony.Sms.getDefaultSmsPackage(getApplicationContext()).equals(getApplicationContext().getPackageName())) {
                      Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT);
                      intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME,
                              getApplicationContext().getPackageName());
                      startActivity(intent);
                  }
              }
  </code></pre>
  
  <p><strong>Manifest file :</strong> </p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.READ_CONTACTS" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_CONTACTS" /&gt;
  &lt;uses-permission android:name="android.permission.READ_CALL_LOG" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_CALL_LOG" /&gt;
  &lt;uses-permission android:name="android.permission.RECEIVE_SMS" /&gt;
  &lt;uses-permission android:name="android.permission.SEND_SMS" /&gt;
  &lt;uses-permission android:name="android.permission.READ_SMS" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_SMS" /&gt;
  &lt;uses-permission android:name="android.permission.CALL_PHONE" /&gt;
  &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.VIBRATE" /&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:supportsRtl="true"
      android:theme="@style/AppTheme.NoActionBar"&gt;
      &lt;activity android:name=".RegisterActivity"&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;activity android:name=".DashboardActivity"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.SEND" /&gt;
              &lt;action android:name="android.intent.action.SENDTO" /&gt;
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
              &lt;data android:scheme="sms" /&gt;
              &lt;data android:scheme="smsto" /&gt;
              &lt;data android:scheme="mms" /&gt;
              &lt;data android:scheme="mmsto" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;activity android:name=".LoginActivity" /&gt;
      &lt;activity android:name=".ContactListActivity" /&gt;
      &lt;activity android:name=".CallLogListActivity" /&gt;
      &lt;activity android:name=".SMSContactListActivity" /&gt;
      &lt;activity android:name=".SettingsActivity" /&gt;
  
      &lt;receiver
          android:name=".PhoneStateReceiver"
          android:enabled="true"
          android:permission="android.permission.BROADCAST_SMS"&gt;
          &lt;intent-filter android:priority="9999"&gt;
              &lt;action android:name="android.intent.action.PHONE_STATE" /&gt;
              &lt;action android:name="android.intent.action.NEW_OUTGOING_CALL" /&gt;
              &lt;action android:name="android.provider.Telephony.SMS_RECEIVED" /&gt;
              &lt;action android:name="android.provider.Telephony.SMS_DELIVER" /&gt;
              &lt;action android:name="android.intent.action.RESPOND_VIA_MESSAGE" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  
      &lt;!-- Service that delivers messages from the phone "quick response" --&gt;
      &lt;service
          android:name=".HeadlessSmsSendService"
          android:enabled="true"
          android:exported="true"
          android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.RESPOND_VIA_MESSAGE" /&gt;
  
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
  
              &lt;data android:scheme="sms" /&gt;
              &lt;data android:scheme="smsto" /&gt;
              &lt;data android:scheme="mms" /&gt;
              &lt;data android:scheme="mmsto" /&gt;
          &lt;/intent-filter&gt;
      &lt;/service&gt;
  
      &lt;activity android:name=".BlockedCallLogActivity" /&gt;
      &lt;activity android:name=".BlockedSmsLogActivity" /&gt;
      &lt;activity android:name=".AboutUsActivity" /&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p>I used this code sample. It shows a dialog with messaging app of phone. My app is not showing on this list. </p>
  
  <p>Now i want to show my app on this list also, so user can select my app from this list and it will be default sms app of that phone. How can i do that. Please reply with example/code-sample. Thanks. </p>