通知操作无法在Android中运行

时间:2016-10-12 19:06:09

标签: android

我有这段代码

template < class D, class E >
class BoostModelContainer : public boost::multi_index_container<D, E>
{
public:
    D* AddItem( const D& item)
    {
        //code here
    }
};

操作在通知中,但是当我按下它时,没有任何反应

非常感谢

enter image description here

2 个答案:

答案 0 :(得分:1)

Intent launchIntent = new Intent(context,WidgetAlarmManagerActivity.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, launchIntent, 0);

getBroadcast()会返回PendingIntent,该sendBroadcast()将在包裹的Intent上调用getActivity()PendingIntent会返回startActivity(),该Intent会在包裹的WidgetAlarmManagerActivity上调用getBroadcast()getActivity()似乎是活动的名称,建议您将 where "ABC" not in (select child.status from Child as child where child.parentFk = parent.parentPk) 替换为{{1}}。

答案 1 :(得分:1)

我认为不是 pendingIntent = PendingIntent.getBroadcast(context,0,launchIntent,0);

你应该使用

pendingIntent = PendingIntent.getActivity(context,                 0,launchIntent,                 PendingIntent.FLAG_CANCEL_CURRENT);