android - Sending immediate notification with options -
so have timer using alarmmanager , once hits 0 want send notification various attributes depending on user chooses (vibrate or not, play sound or not, show text or not, show... rectangle thingy in drop-down tray whatever it's called, etc).
i not sure expected class use here since it's immediate, i.e. it's after alarm manager has hit 0 , in onreceive() method of broadcast receiver, don't think need use pendingintent @ point.
do use notificationcompat.builder
? need? , if use support v4 or v7 version?
trying this:
notificationcompat.builder notificationbuilder = new notificationcompat.builder(c) .setsmallicon(r.mipmap.ic_launcher) .setlargeicon(bitmapfactory.decoderesource(c.getresources(), r.mipmap.ic_launcher)) .setsound(ringtonemanager.getdefaulturi(ringtonemanager.type_notification)) .setcontenttext("this text should in notification drawer!"); notificationmanager notificationmanager = (notificationmanager) c.getsystemservice(notification_service); notificationmanager.notify(1, notificationbuilder.build()); toast.maketext(c, "toast text!", toast.length_long).show();
as per discussion in comments -
yes notificationcompat.builder
of above things need. .build enough send notification instantly. , if want set specific time can use .setwhen well. can find methods related action need here - notification developer guide
Comments
Post a Comment