首页 > 代码库 > 关于Android中new Notification

关于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();   

 

关于Android中new Notification