1

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());
    }
}
Community
  • 1
  • 1
scottyab
  • 23,621
  • 16
  • 94
  • 105
  • 1
    Are you sure there is nothing on your device that has a higher priority and would consume the SMS broadcast event? Have you tried this in the ICS emulator? – CommonsWare Jun 30 '12 at 17:42
  • The SMS/ MMS API has not changed in Android 4.0 ICS. @CommonsWare has the right idea, an app like GO SMS might have a higher priority and is calling abortBroadcast(). Set the priority to 214783648 (the highest possible) and see if that helps and/ or remove any app that might interfere. – Tom Jun 30 '12 at 20:25

1 Answers1

4

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.

scottyab
  • 23,621
  • 16
  • 94
  • 105