I am using Broadcast Receiver
to trigger for incoming messages
every time. Its working fine in Android O
either app is closed or not. But in Android P
its only working when app is live and when app is closed its not working. It should always work either app is close or not in Android P
. I followed this link and many others but problem is still there.
Receiver Registration in Manifest
<receiver
android:name=".Broadcast.SmsListener"
android:enabled="true"
android:exported="true"
android:permission="android.permission.BROADCAST_SMS">
<intent-filter android:priority="999">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
Broadcast Receiver Class
public class SmsListener extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("Resulted12", "Into onReceive()");
context.startService(new Intent(context, BackgroundService.class));
}
}
Is there anything else which i missed?