【发布时间】:2016-08-02 16:56:11
【问题描述】:
我有一个广播接收器类,当我收到特定广播时,我想停止前台通知。所以我尝试了context.stopForeground(),但智能感知没有显示该方法。我们如何在广播接收器类中调用stopForeground()方法?
public class Broad extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction()==Const.ACTION_STOP)
{
// unable to call like this
context.stopForeground();
}
}
}
【问题讨论】:
标签: android broadcastreceiver android-notifications foreground-service