简体   繁体   English

Android:使用Alarm Manager同时启动多个挂起的意图

[英]Android: Starting multiple pending intents as same time using Alarm Manager

in my application i want to set multiple reminders. 在我的应用程序中,我想设置多个提醒。 The code i used is following, 我使用的代码如下,

    intnt = new Intent(appConxt, RempopActivity.class);
    intnt.putExtra("evinfo", evtime + " " + rem.getname()
            + "\n will start in " + remtime + " minutes");
    intnt.putExtra("evid", remcon.getEvid());
    intnt.putExtra("remId", remcon.getRemid());
    intnt.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);

    pendingIntent = PendingIntent.getActivity(appConxt, remcon.getRemid(), intnt,
            PendingIntent.FLAG_ONE_SHOT);
    am = (AlarmManager) appConxt.getSystemService(Context.ALARM_SERVICE);
    am.set(AlarmManager.RTC_WAKEUP, date.getTime() - (remtime * 60000),
            pendingIntent);

My question is even after having different requestCode , if more than one pending intent starting at same time only one pending intent is displayed other pending intents wont come up. 我的问题是,即使在具有不同的requestCode之后 ,如果同时开始多个未决意图,则只显示一个未决意图,其他未决意图将不会出现。 How can i get all the pending intents. 我怎样才能得到所有待定的意图。

There is no mistake with above code, since i had RempopActivity as "SingleInstance" in Manifest file, according to activity Launch mode for SingleInstance no more task is added on top of this activity. 上面的代码没有错误,因为我在Manifest文件中将RempopActivity作为“SingleInstance”,根据SingleInstance的活动启动模式,在此活动之上不再添加任务。 For above code to work fine use Launch Mode as "standard". 要使上述代码正常工作,请使用启动模式作为“标准”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM