I'm creating alarms with AlarmManager, in some devices the alarm works, but in others like ASUS and XIAOMI does not work, not even in the receiver class, has anyone ever been through this?
Method that creates the alarm
Calendar cal = Calendar.getInstance();
cal.add(Calendar.SECOND, 10);
Intent intent = new Intent(getBaseContext(), TesteAlarmeReceiver.class);
PendingIntent pendingIntent =
PendingIntent.getBroadcast(getBaseContext(), 1232312, intent, PendingIntent.FLAG_ONE_SHOT);
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent);
Toast.makeText(getBaseContext(), "call alarmManager.set()", Toast.LENGTH_LONG).show();
Manifest
<receiver android:name=".teste_alarme.TesteAlarmeReceiver"
android:process=":remote" />
Receiver
public class TesteAlarmeReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.e("Paulo","Receiver");
Toast.makeText(context,
"AlarmReceiver.onReceive()",
Toast.LENGTH_LONG).show();
}
}