Android-替换不推荐的通知类
我想知道我可以用什么来替换Android-替换不推荐的通知类,android,android-notifications,Android,Android Notifications,我想知道我可以用什么来替换不推荐使用的通知类和setLatestEventInfo()方法。它无法识别setLatestEventInfo()方法 以下是我的当前代码: public void makeForeground() { Notification notification = new Notification(R.drawable.icon, getText(R.string.servicename), System.currentTimeMillis()); notifica
不推荐使用的通知类
和setLatestEventInfo()
方法。它无法识别setLatestEventInfo()
方法
以下是我的当前代码:
public void makeForeground() {
Notification notification = new Notification(R.drawable.icon, getText(R.string.servicename), System.currentTimeMillis());
notification.setLatestEventInfo(this, getText(R.string.servicename), this.lang[134], PendingIntent.getActivity(this, 0, new Intent(this, UIActivity.class), 0));
startForeground(2, notification);
}
我可以用什么替换它?您可以使用NotificationCompat替换通知 您可以在此处阅读更多内容:
你能给我一个启动前台服务的例子吗。他们仍在文档站点上使用SetLateStevenInfo。