(2)创建一个Notification对象,并为其设置各种属性
(3)为Notification对象设置事件信息
(4)通过NotificationManager类的notify()方法发送Notification...通知
下面通过一个具体的实例说明如何使用Notification在状态栏上显示通知:
res/layout/main.xml:
<?...MainActivity.this, "无题", "每天进步一点点", null);//设置事件信息
notificationManager.notify(NOTIFYID_1,notify);//通过通知管理器发送通知...,在下面就是通知被点击时激活的组件对象(上下文,请求码,意图对象,标识符)
PendingIntent pendingIntent=PendingIntent.getActivity(MainActivity.this..., "通知", "查看详细内容", pendingIntent);
notificationManager.notify(NOTIFYID_2,notify);//通过通知管理器发送通知
}
})