android - Notification doesn't show light with sound set -
when add .setdefaults(default_sound) or default_lights or default_all, shows heads notification, doesnt show light set .setlights(0x0ff00ff0, 300, 100). if remove .setdefaults doesn't show heads up, shows lights.
intent notificationintent = new intent(intent.action_view); notificationintent.setdata(uri.parse("http://www.wgn.com")); pendingintent contentintent = pendingintent.getactivity(this, 0, notificationintent, 0); notification notification = new notificationcompat.builder(this) .setcategory(notification.category_message) .setcontenttitle("yi warning") .setcontenttext("battery below 20%") .setsmallicon(r.drawable.ic_launcher) .setautocancel(true) .setvisibility(1) .setcontentintent(contentintent) .setpriority(notification.priority_max) .setdefaults(notification.default_sound) .setlights(0x0ff00ff00, 300, 100).build(); notificationmanager notificationmanager = (notificationmanager) getsystemservice(notification_service); notificationmanager.notify(notification_id, notification);
removed
.setdefaults(notification.default_sound)
and added
.setsound(ringtonemanager.getdefaulturi(ringtonemanager.type_notification))
now working great :d
Comments
Post a Comment