android - PendingIntent error ( Must be one or more of: PendingIntent.FLAG_ONE_SHOT …..) -
i trying create pendingintent in android. here code
mnotificationintent = new intent(getapplicationcontent(), myalarm.class); mcontentintent = pendingintent.getactivity(getapplicationcontext(), 0, mnotificationintent, intent.flag_activity_new_task);
and getting following error:
must 1 or more of: pendingintent.flag_one_shot,pendingintent.flag_no_create, pendingintent.flag_update_current, intent.fill_in_action, intent.fill_in_data, intent.fill_in_categories…..)
why error showing ? how resolve this? please help. thank you.
you passing intent.flag_activity_new_task
when method call expects pendingintent
flag. if want add intent.flag_activity_new_task
intent
, need this:
mnotificationintent = new intent(getapplicationcontent(), myalarm.class); mnotificationintent.addflags(intent.flag_activity_new_task); mcontentintent = pendingintent.getactivity(getapplicationcontext(), 0, mnotificationintent, 0);
Comments
Post a Comment