我不是开发人员,我正在努力让一些示例代码正常运行。 我正在运行的API与我正在使用的代码不完全兼容。(API15)。
是否有人能够帮助我重新格式化此代码以使用更新的样式builder notifications?
(我试过了,但根据链接的问题找不到正确的方法)
{
Notification notification = new Notification(R.drawable.ic_launcher, "Robot service running", System.currentTimeMillis());
notification.setLatestEventInfo(this, "Robot Service", "Click to stop", PendingIntent.getService(this, 0, new Intent("stop", null, this, this.getClass()), 0));
notification.flags |= Notification.FLAG_ONGOING_EVENT;
nm.notify(0, notification);
}
答案 0 :(得分:0)
Notification noti = new Notification.Builder(mContext)
.setContentTitle("New mail from " + sender.toString())
.setContentText(subject)
.setSmallIcon(R.drawable.new_mail)
.setLargeIcon(aBitmap)
.build();
有关详细信息,请使用以下链接:
http://developer.android.com/reference/android/app/Notification.Builder.html