I have a following BroadcastReceiver
which should run after boot completion. I have tested it on my Xiaomi device (Redmi 1s), it's not running, while on other devices like Samsung it's running as expected.
public class DeviceBootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
Toast.makeText(context, "I am Running", Toast.LENGTH_SHORT).show();
}
}
}
I have set permission in Manifest.
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
And following is my broadcast receiver:
<receiver android:name=".receiver.DeviceBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>