0

My private app receives broadcast SMS. I want to abort the SMS from specific numbers.For this, I made my private app as the default app. Now every SMS automatically aborted and Messaging app cannot recieve any SMS.

Please guide me where I am wrong. I don't want to abort all SMS.

Thanks

I have attached my manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.muhammadnaveed.test2">

    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="23" />

    <!-- Permissions to receive and read SMS -->
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.READ_SMS" />
    <uses-permission android:name="android.permission.READ_CONTACTS"/>
    <uses-permission android:name="android.permission.WRITE_CONTACTS"/>


    <application
        android:allowBackup="true"
        android:icon="@mipmap/contact1"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/contact2"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity android:name="com.example.muhammadnaveed.AutoSaveContact.AutoContactSave">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- BroadcastReceiver that listens for incoming SMS messages -->
        <receiver android:name="com.example.muhammadnaveed.AutoSaveContact.SMSBReceiver"
            android:permission="android.permission.BROADCAST_SMS">
            <intent-filter android:priority="1000">
                <action android:name="android.intent.action.PHONE_STATE" />
                <action android:name="PACKAGE_NAME.android.action.broadcast"/>
                <action android:name="android.provider.Telephony.SMS_RECEIVED"/>
                <action android:name="android.provider.Telephony.SMS_DELIVER"/>

            </intent-filter>
        </receiver>

        <!-- BroadcastReceiver that listens for incoming MMS messages -->
        <receiver android:name=".MmsReceiver"
            android:permission="android.permission.BROADCAST_WAP_PUSH">
            <intent-filter>
                <action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" />
                <data android:mimeType="application/vnd.wap.mms-message" />
            </intent-filter>
        </receiver>

        <!-- Activity that allows the user to send new SMS/MMS messages -->
        <activity android:name=".SendSms">
            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <action android:name="android.intent.action.SENDTO" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="sms" />
                <data android:scheme="smsto" />
                <data android:scheme="mms" />
                <data android:scheme="mmsto" />
    </intent-filter>
    </activity>
        <activity android:name="com.example.muhammadnaveed.AutoSaveContact.MessageList">

        </activity>


<!-- Service that delivers messages from the phone "quick response" -->
        <service android:name=".HeadlessSmsSendService"
            android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE"
            android:exported="true" >
            <intent-filter>
                <action android:name="android.intent.action.RESPOND_VIA_MESSAGE" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="sms" />
                <data android:scheme="smsto" />
                <data android:scheme="mms" />
                <data android:scheme="mmsto" />
            </intent-filter>
        </service>

    </application>

</manifest>
P.J.Meisch
  • 18,013
  • 6
  • 50
  • 66
  • Starting with KitKat, if your app is the default app, it is responsible for everything. You can't just hand off whatever you don't want to handle to another app. Furthermore, yours will be the only app to receive the `SMS_DELIVER` broadcast, so you're not really aborting anything anyway. If you mean you're having problems on versions prior to KitKat, you'll need to post a [mcve] demonstrating the issue. – Mike M. May 06 '17 at 15:10
  • I have a problem on version above to KitKat. Actually, I have two apps to receive the SMS_DELIVER broadcast. One is OS App (Messaging) and other is MyPrivate app. On settings, I changed MYPrivate App to default app. After that, I only receive sms in MYPrivate app. I need Messaging app also receive sms. – Muhammad Naveed May 06 '17 at 16:07
  • Only one app gets the `SMS_DELIVER` broadcast - the app that is the current default app. No other app will get it. You can't do what you're trying to do. – Mike M. May 06 '17 at 16:11
  • 1
    Thank s, Mike for your quick response. – Muhammad Naveed May 06 '17 at 16:45

0 Answers0