I am trying to capture an SMS received by phone, but when the phone receives an SMS, the 'onReceive' method is not called. This is my code:
I have a BroadcastReceiver declared in AndroidManifest.xml inside the app tag:
<receiver android:name=".util.IncomingSmsReceiver"
android:exported="true">
<intent-filter android:priority="2147483647">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
This is IncomingSmsReceiver.java
public class IncomingSmsReceiver extends BroadcastReceiver {
public static final String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";
@Override
public void onReceive(Context context, Intent intent) {
Log.i(TAG, "onReceive executed");
if (intent.getAction().equals(SMS_RECEIVED)) {
...
}
}
}
Google Nexus 5 Android 6. sms () , , , , . logcat Android Studio , onReceive
, . , android:enabled="true"
, registerReceiver
. - , - ?