Search code examples
androidbroadcastreceiverandroid-4.0-ice-cream-sandwich

Android SMS receiver not working in ICS even after app started


This might look like a duplicate issue at first, however I'm aware of the change in Android 3.1 that requires apps to be in started start to receive broadcasts and this related question. Maybe it's a school boy error I'm not seeing. But this works a treat on Android 2.3, and other receivers are working (i.e. android.net.wifi.SCAN_RESULTS). On Android 4.0.4, Galaxy Nexus.

The functionality I'm trying to get working on ICS: install > launch > if no user details send text via sms app > SmsReceiver checks incoming reply and populates login details (saving the user copy and pasting)

What am i missing?

Manifest

<uses-permission android:name="android.permission.RECEIVE_SMS" />
<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:hardwareAccelerated="true"
    >

    <receiver
        android:name="com.myapp.android.receivers.SmsParserReceiver"
        android:enabled="true" android:exported="true"
        >
        <intent-filter android:priority="3000">
            <action android:name="android.provider.Telephony.SMS_RECEIVED" />
        </intent-filter>
    </receiver>

Receiver:

package com.myapp.android.receivers;
public class SmsParserReceiver extends BroadcastReceiver
{

    public SmsParserReceiver()
    {
        QLog.i("SmsParserReceiver created");
    }

    @Override
    public void onReceive(Context context, Intent intent)
    {
        QLog.i("Smsintent recieved: " + intent.getAction());
    }
}

Solution

  • After testing several devices and emulator came to the same conclusion as @commonsware and @Tom another app (in the original test case GoSMS) is intercepting the boardcast and aborting it.