Broadcastreceiver is not called on some devices

Asked

Viewed 95 times

0

I am 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, someone has already gone 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();
    }
}
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.