private void showNotifycation(String number)
{
//拿到Nofitication的管理者
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
//new一个Nofitication出来
Notification notification = new Notification(R.drawable.notification, "发现响一声电话", System.currentTimeMillis());
Context context = getApplicationContext();
//设置成一点击就消失
notification.flags = Notification.FLAG_AUTO_CANCEL;
Intent notificationIntent = new Intent(context, NumberSecurityActivity.class);
notificationIntent.putExtra("number", number);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, "响一声号码", number, pendingIntent);
//激活Nofitication
notificationManager.notify(0, notification);
}
这段代码中的Nofitication显示The constructor Notification(int, CharSequence, long) is deprecated
安卓开发中Nofitication有问题
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
0条回答 默认 最新
悬赏问题
- ¥15 delta降尺度计算的一些细节,有偿
- ¥15 Arduino红外遥控代码有问题
- ¥15 数值计算离散正交多项式
- ¥30 数值计算均差系数编程
- ¥15 redis-full-check比较 两个集群的数据出错
- ¥15 Matlab编程问题
- ¥15 训练的多模态特征融合模型准确度很低怎么办
- ¥15 kylin启动报错log4j类冲突
- ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
- ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序