-1

I am implementing sms receive functionality in Android kitkat 4.4+. I am able to set my application as default successfully but when an sms is received broadcast receiver is called twice. I am unable to find the cause of this problem.

here is how I have declared my Broadcast reciever in manifest

        <receiver
            android:name="com.package.SmsRecieverKitkat"
            android:enabled="true"
            android:exported="true"
            android:permission="android.permission.BROADCAST_SMS" >
            <intent-filter  >
                 <action android:name="android.provider.Telephony.SMS_RECEIVED" />
               <action android:name="android.provider.Telephony.SMS_DELIVER" />
            </intent-filter>
        </receiver>
Cœur
  • 37,241
  • 25
  • 195
  • 267
Saad Asad
  • 2,528
  • 3
  • 20
  • 27

1 Answers1

2

when an sms is recieved broadcast reciever is called twice

That is because you are asking for both SMS_RECEIVED and SMS_DELIVER broadcasts. If you only want one of those, only listen for that one.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491