0

I have searched in everywhere but I can understand because my Service at a specific time of the day don't fire. Nothing happens. My code for set up the Alarm:

AlarmManager alarmMgr = (AlarmManager) act.getSystemService(Context.ALARM_SERVICE);
        Intent intent = new Intent(act, AlarmReceiver.class);
        PendingIntent alarmIntent = PendingIntent.getBroadcast(act, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
        // set for 5 seconds later
        alarmMgr.set(AlarmManager.RTC_WAKEUP, Calendar.getInstance().getTimeInMillis()+5000, alarmIntent);

My code for the Service:

public class AlarmReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {

        System.out.println("Alarm worked well");
        Utils.criarNotificacao(context);
    }
}

In the Manifest:

<receiver android:name="br.com.blacktoad.q48h2.utils.AlarmReceiver" android:process=":remote"></receiver>

I can't find any answer.

Siloé Bezerra Bispo
  • 2,056
  • 1
  • 17
  • 31

1 Answers1

0

I find the error! I need put the:

<receiver android:name="br.com.blacktoad.q48h2.utils.AlarmReceiver" android:process=":remote"></receiver>

in the manifest, but contained in the "application" tag

Siloé Bezerra Bispo
  • 2,056
  • 1
  • 17
  • 31