android学习--Notification

来源:互联网 发布:string转化为int数组 编辑:程序博客网 时间:2024/06/07 22:49


关于notification需要注意以下几点:

1) 2.3及其以下必须设置contentIntent

if (mContentIntent == null && Build.VERSION.SDK_INT <= 10) {
this.mBuilder.setContentIntent(PendingIntent.getActivity(context, 0, new Intent(), PendingIntent.FLAG_CANCEL_CURRENT));
}

2) 2.3及其以下版本中,自定义布局中的按钮,点击事件可能会失灵,所以必须隐藏按钮

// 2.3及其以下若要使用自定义布局,必须再次手动设置才起效
if (mContentView != null && Build.VERSION.SDK_INT <= 10) {
notification.contentView = mContentView;
}

3) 4.1及其以上才有 bigContentView

if (mBigContentView != null && Build.VERSION.SDK_INT >= 16) {
notification.bigContentView = mBigContentView;
}

0 0
原创粉丝点击