在状态栏中添加应用程序图标并打开
public static void showNotification()
{
NotificationManager nm = (NotificationManager) DownLoadActivity.mContext
.getSystemService(NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.lx_download,
"xxxx", System.currentTimeMillis());
Intent intent = new Intent(mapIndex.curr, DownLoadActivity.class);
PendingIntent pendIntent = PendingIntent.getActivity(
DownLoadActivity.mContext, 0, intent, 0);
notification.setLatestEventInfo(DownLoadActivity.mContext,
"xxxx", "xxx", pendIntent);
nm.notify(0, notification);
}
移除图标:
public static void doExit()
{
try {
NotificationManager nm = (NotificationManager)DownLoadActivity.mContext.getSystemService(NOTIFICATION_SERVICE);
nm.cancel(0);
} catch (NullPointerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}