欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android  Notification使用方法詳解

 更新時(shí)間:2017年05月25日 14:52:00   作者:宋錚  
這篇文章主要介紹了Android Notification使用詳解的相關(guān)資料,需要的朋友可以參考下

Android  Notification使用詳解

Notification

核心代碼(鏈?zhǔn)秸{(diào)用):適用于Android 4.0以上(不兼容低版本)

Notification noti = new Notification.Builder(this)
.setContentTitle("標(biāo)題名稱(chēng)")
.setContentText("標(biāo)題里的內(nèi)容")
.setSmallIcon(R.drawable.new_mail)
.setLargeIcon(BitmapFactory.decordResource(getResources(), R.drawable.ic_launcher))
.build();

NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
nm.notify(0, noti);

兼容版本

Notification notification = new Notification(R.drawable.ic_launcher, "xxxxxx", System.currentTimeMillis());
//點(diǎn)擊事件真正想執(zhí)行的動(dòng)作
Intent intent = new Intent();
intent.setAction(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:110"));
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
notification.setLatestEventInfo(this, "標(biāo)題", "內(nèi)容", contentIntent);
NotificationManager nm = (NotificationManager) getSystemManager(NOTIFICATION_SERVICE);
nm.notify(0, notification);

感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!

相關(guān)文章

最新評(píng)論