Alarmmanager - 第二次警报未开火

时间:2014-02-25 15:17:50

标签: android android-intent alarmmanager

我有一个用于设置闹钟的GCM意向服务和另一个用于设置第二个闹钟的警报,出于测试目的,我有两个方法的警报接收器来显示祝酒词。

第一个吐司是显示但第二个吐司永远不会出现。他们个人独立工作。有人能发现我做错了吗?

由于

    private void gcmalarmset(Calendar targetCal, String hour, String minute) {

          Log.i(TAG,"gcmalarmset method started");

          //set alarm
          AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
          Intent intent = new Intent(getBaseContext(), test1.class);
          PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), 2, intent, 0);
          alarmManager.set(AlarmManager.RTC_WAKEUP, targetCal.getTimeInMillis(), pendingIntent);




        }     

 private void alarmunset(Calendar targetCal, String hour, String minute) {

          Log.i(TAG,"gcmalarmunset method started");

          //set alarm
          AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
          Intent intent = new Intent(getBaseContext(), test2.class);
          PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), 1, intent, 0);
          alarmManager.set(AlarmManager.RTC_WAKEUP, targetCal.getTimeInMillis(), pendingIntent);

        }

0 个答案:

没有答案