I registered a broadcast receiver in my manifest like this :
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<receiver android:name=".SMSReceiver" android:permission="android.permission.RECEIVE_SMS" android:exported="true">
<intent-filter android:priority="9999">
<action android:name="android.provider.telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
</application>
And my SMSReceiver class like this :
public class SMSReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
if (intent.getAction().equalsIgnoreCase("android.provider.Telephony.SMS_RECEIVED")) {
...
But the code in the onReceive method is never called. I've tried without the android:exported and android:permission tags in the receiver, but nothing works.