Sunday, 15 February 2015

Heads-up Notification - Android Lollipop -



Heads-up Notification - Android Lollipop -

i'm trying show notification-type heads-up not. tried

final notification.builder notif = new builder(getapplicationcontext()) .setcontenttitle(getstring(r.string.title)) .setcontenttext(getstring(r.string.text)) // .setticker(getstring(r.string.tick)) removed, seems not show @ // .setwhen(system.currenttimemillis()) removed, match default // .setcontentintent(contentintent) removed, don't neet .setcolor(color.parsecolor(getstring(r.color.yellow))) //ok .setsmallicon(r.drawable.ic_small) //ok .setlargeicon(bitmapfactory.decoderesource(getresources(), r.drawable.ic_launcher)) // .setcategory(notification.category_call) not seem create difference .setpriority(notification.priority_max); //does not seem create difference // .setvisibility(notification.visibility_private); //does not seem create difference mnotificationmanager.notify(constants.notification_id, notif.build());

the notification shown icon in bar. i'm using api 21 on api21 emulator (not l preview) tried android:theme.holo.noactionbar , android:theme.holo.noactionbar.fullscreen , notificationcompat.builder

sdk examples not available. know how it?

i made working adding

.setdefaults(notification.default_vibrate)

is best way?

according notifications, required set vibrate or ringtone create heads-up work. however, here's quick hack doesn't require vibrate permission produce head-up notification:

notificationbuilder.setpriority(notification.priority_high); if (build.version.sdk_int >= 21) notificationbuilder.setvibrate(new long[0]);

android android-5.0-lollipop android-notifications

No comments:

Post a Comment