5
我已创建通知时服务的开始,但我还没有知道如何关闭通知时停止服务或破坏。有什么想法。关闭Android通知
以下即开始通知时,服务启动代码。
String ns = Context.NOTIFICATION_SERVICE;
final int KEEPUS_NOTIFICATION_ID = 1;
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(ns);
Notification notification = new Notification(R.drawable.notification_icon1, ticker_text, System.currentTimeMillis());
Intent notificationIntent = new Intent(context, KeepusActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, ticker_content_title, ticker_content_text,contentIntent);
mNotificationManager.notify(KEEPUS_NOTIFICATION_ID, notification);