Android Marshmallow sound only Notification? -
in lollipop , below, send sound notification omitting icon, content title , content text when constructing, so:
notificationcompat.builder builder = new notificationcompat.builder(getapplicationcontext()); builder.setsound(uri.parse(ringtone)); notificationmanager.notify(9998, builder.build());
in marshmallow, i'm forced include @ least icon, or 'no valid small icon' exception. want use notification system, don't want display notification in notification bar. possible marshmallow, or should change playing notification sound media player, though i, or user, may want display notification?
i read somewhere docs said icon required thought didn't throw exception when omitted in lollipop , below. after looking using mediaplayer, decided use rintonemanager play it. using notification sounds, may save myself typing , quick
try { ringtonemanager.getringtone(getapplicationcontext(), uri.parse(ringtone)).play(); } catch (exception e) { e.printstacktrace(); }
to trigger sound, i'll save notification when need actual notification. planing on using if, depending on whether or not notification should appear in notification bar.
Comments
Post a Comment