Reputation: 1
I have a simple sms broadcast receiver registered in manifest.
Manifest:
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<application ...>
<receiver
android:name=".SmsReceiver"
android:enabled="true"
android:exported="true"
android:permission="android.permission.BROADCAST_SMS">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
</application>
Receiver class:
class SmsReceiver: BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
if (intent.action == Intents.SMS_RECEIVED_ACTION) {
Log.i("sms", "received")
}
}
}
It work fine except for when a new process is created in response to a new sms - when device is rebooted or my app closed (and its process ended) first sms just triggers a new process start and only subsequent messages are processed by receiver.
Can someone explain to me this android behavior?
Upvotes: 0
Views: 31