关于Android中new Notification

目前 Android 已经不推荐使用下列方式创建 Notification实例:

1 Notification notification = new Notification(R.drawable.ic_launcher,"This is ticker text",System.currentTimeMillis());

最好采用下列方式:

                Notification notification = new Notification.Builder(this)
                    .setContentTitle("This is title")
                    .setContentText("This is content")
                    .setSmallIcon(R.drawable.ic_launcher)
                        .setTicker("This is ticker")
                        .setContentIntent(pi)
                    .build();
   

 

posted @ 2016-08-30 23:59  itoysk  阅读(505)  评论(0编辑  收藏  举报