Notification not showing up time in android -
i have created custom notification, not able show current time in notification bar.. not coming though showing system.currenttimemillis()
.
final notification notification = new notification(r.drawable.notificationicon, context.getresources().getstring(r.string.notificationheadingtext), system.currenttimemillis()); notification.flags = notification.flags | notification.flag_ongoing_event; notification.when = system.currenttimemillis(); int currentapiversion = android.os.build.version.sdk_int; if (currentapiversion > 20) { notification.contentview = new remoteviews(getapplicationcontext().getpackagename(), r.layout.notification_process); } else { notification.contentview = new remoteviews(getapplicationcontext().getpackagename(), r.layout.notification_process_lowerversion); } uri alarmsound = ringtonemanager.getdefaulturi(ringtonemanager.type_notification); notification.sound = alarmsound; notification.contentintent = pendingintent; notification.contentview.setimageviewresource(r.id.status_icon, r.drawable.ic_launcher); notification.contentview.settextviewtext(r.id.status_text, context.getresources().getstring(r.string.notificationheadingtext)); notificationmanager.notify(42, notification);
notification class deprecated. use notificationcompat. read tutorial
Comments
Post a Comment