My SMS receiving code works good on all devices except Xiomi Redmi devices
On Xiomi Redmi devices, my app(Broadcast Receiver) not able to receive SMS when app gets killed by swiping from recent app list OR after device restart until I start the app manually. (Tested on Mi Marshmallow and MI Lollipop devices).
This issue happens only on MI devices. App works good on other devices like Samsung, HTC, Sony, Motorola, Micromax etc.
my code in manifest:
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<receiver
android:name=".receiver.SMSBroadcastReceiver"
android:enabled="true"
android:priority="999">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
Broadcast Receiver:
public class SMSBroadcastReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
if (Constants.SMS_RECEIVED_ACTION.equals(intent.getAction())) {
mContext = context.getApplicationContext();
mIntent = intent;
sendIntent();
} else {
LogUtil.e(TAG, "Intent action: " + intent.getAction());
}
}
}
onReceive
is invoked when SMS is received? – Bernice