Enabling SMS support in Hangouts 2.0 breaks the BroadcastReceiver of SMS_RECEIVED in my app

Flow

I just received the update for Hangouts 2.0, installed it and enabled SMSTurn on SMS. Now my application, running under Android 4.3, is unable to receive SMS any more, i.e. my BroadcastReceiver for SMS_RECEIVED is no longer called. :-(

As soon as I disable Turn on SMS in Hangouts 2.0, my app is able to receive SMS_RECEIVED intents again.

The Broadcast receiver is registered in the Manifest like this

AndroidManifest.xml

…
<receiver android:name=".SMSReceiver" >
    <intent-filter>
        <action android:name="android.provider.Telephony.SMS_RECEIVED" />
    </intent-filter>
</receiver>
…

SMSReceiver.java

public class SMSReceiver extends BroadcastReceiver {

    private static final Log LOG = Log.getLog();

    @Override
    public void onReceive(Context context, Intent intent) {
            LOG.d("onReceive");
            …
    }
}

I already tried to change the priority of the receiver to INT_MAX or 999, which is the highest possible priority as of the intent-filter documentation, but without success. I know that SMS_RECEIVED intents are send ordered and that high priority apps have the ability to abort the broadcast.1 But it seems unlikely that Hangouts 2.0 is registering the SMS_RECEIVED receiver with a high priority and calling abortBroadcast(), therefore preventing any other apps from receiving the intent.

What further confused me, is that my Pebble is still able to receive SMS, even with Hangouts 2.0 as default SMS app. I wonder what Pebble does different? I just noticed that the incoming SMS notification on my Pebble are no longer notifications for new SMS that are received by the Pebble app, but instead are "new Hangout message" notifications that are caused by hangouts receiving the incoming SMS. So the Pebble app is also not able to receive incoming text messages with SMS_RECEIVED.

On a side note and not really related to this issue, because I am still on Android 4.3 (but my app targets SDK level 19, Android 4.4 in case it matters) Google's Android Developers Blog post about the new SMS API in Kitkat, said that nothing would change for apps using just SMS_RECEIVED and don't try to write the SMS to the SMS Provider.

1 I always believed that the SMS_RECEIVED broadcast is abortable. But the Android 4.4 APIs site says something different: "…when a new SMS arrives by listening for the SMS_RECEIVED_ACTION broadcast, which is a non-abortable broadcast…"

Flow

Fixed it.

The first problem was that, as you can see in revision 2 of my question, I put the priority attribute within the action element, when it actually belongs into the intent-filter element. So the priority didn't work.

While still targeting API 19, I did some experiences with Hangouts SMS enabled and different priorities.

  • No priority set → BroadcastReceiver doesn't receive SMS_RECEIVED intent
  • Priority 500 → BroadcastReceiver does receive SMS_RECEIVED intent
  • Priority 9991 → BroadcastReceiver does receive SMS_RECEIVED intent

So it seems that you need to have a minimum value for priority in order to get the intent with Hangouts SMS enabled. I didn't bother to bisect the lowest possible value. ;) I am going with 999 as I don't see any reason to get lower because my app does just some quick checks on the received sms and does not further process it. But it should really make a difference, as the broadcast is non-abortable.

1The maximum value

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Enabling SMS support in Hangouts 2.0 breaks the BroadcastReceiver of SMS_RECEIVED in my app

From Dev

BroadcastReceiver SMS_Received not working on new devices

From Dev

SMS received broadcastReceiver is not called when app is not running

From Dev

SMS Link Not Working for Hangouts on Android

From Dev

BroadcastReceiver doesn't handle SMS received

From Dev

Receiving SMS messages in my app

From Dev

Saving sms was sent from my app into db of sms app native

From Dev

Android SMS App Opens Within My App

From Dev

What is the best way to do work on SMS_RECEIVED on Android?

From Dev

What is the best way to do work on SMS_RECEIVED on Android?

From Dev

Update Listview from Sms BroadcastReceiver

From Dev

cant read last sms in BroadcastReceiver

From Dev

Is it possible to open my app through inbox SMS?

From Dev

Is it possible to open my app through inbox SMS?

From Dev

How to receive sms on my ios app (workaround)?

From Dev

Execute action when SMS is received in UWP app

From Dev

Twillio SMS support in The Netherlands

From Dev

Android KitKat 4.4 Hangouts cannot handle Sending SMS intent

From Dev

How do I set my app as the default SMS app?

From Dev

How to unset my sms app as default app in Android

From Dev

Android - how to make my app default sms app programatically

From Dev

Detecting incoming SMS using BroadcastReceiver not working

From Dev

How to fix Unprotected SMS BroadcastReceiver lint warning

From Dev

Receiving and sending SMS in one BroadcastReceiver (Android)

From Dev

using SMS BroadcastReceiver for both Kitkat and old versions

From Dev

Receiving and sending SMS in one BroadcastReceiver (Android)

From Dev

Intercept android SMS going to default inbox - BroadcastReceiver

From Dev

Enabling my disabled app programmatically

From Dev

BroadcastReceiver is not working in my android app

Related Related

  1. 1

    Enabling SMS support in Hangouts 2.0 breaks the BroadcastReceiver of SMS_RECEIVED in my app

  2. 2

    BroadcastReceiver SMS_Received not working on new devices

  3. 3

    SMS received broadcastReceiver is not called when app is not running

  4. 4

    SMS Link Not Working for Hangouts on Android

  5. 5

    BroadcastReceiver doesn't handle SMS received

  6. 6

    Receiving SMS messages in my app

  7. 7

    Saving sms was sent from my app into db of sms app native

  8. 8

    Android SMS App Opens Within My App

  9. 9

    What is the best way to do work on SMS_RECEIVED on Android?

  10. 10

    What is the best way to do work on SMS_RECEIVED on Android?

  11. 11

    Update Listview from Sms BroadcastReceiver

  12. 12

    cant read last sms in BroadcastReceiver

  13. 13

    Is it possible to open my app through inbox SMS?

  14. 14

    Is it possible to open my app through inbox SMS?

  15. 15

    How to receive sms on my ios app (workaround)?

  16. 16

    Execute action when SMS is received in UWP app

  17. 17

    Twillio SMS support in The Netherlands

  18. 18

    Android KitKat 4.4 Hangouts cannot handle Sending SMS intent

  19. 19

    How do I set my app as the default SMS app?

  20. 20

    How to unset my sms app as default app in Android

  21. 21

    Android - how to make my app default sms app programatically

  22. 22

    Detecting incoming SMS using BroadcastReceiver not working

  23. 23

    How to fix Unprotected SMS BroadcastReceiver lint warning

  24. 24

    Receiving and sending SMS in one BroadcastReceiver (Android)

  25. 25

    using SMS BroadcastReceiver for both Kitkat and old versions

  26. 26

    Receiving and sending SMS in one BroadcastReceiver (Android)

  27. 27

    Intercept android SMS going to default inbox - BroadcastReceiver

  28. 28

    Enabling my disabled app programmatically

  29. 29

    BroadcastReceiver is not working in my android app

HotTag

Archive