Office Hours — Today, May 22

Saturday, May 19

Mark M.
has entered the room
May 22
8:55 AM
Mark M.
turned on guest access
9:40 AM
Milan
has entered the room
Mark M.
hello, Milan!
how can I help you today?
9:45 AM
Milan
Hello Mark. One question, regarding updating in progress notification. Consider next scenario: Message (file transfer) is received, notification is fired with vibration & ringtone played by notification itself. Once it is accepted, progress should be shown on notification, so notification is updated every x unit of time. Notification should not play vibration&ringtone each time it is updated. Keeping in mind we are speaking about 8 and above OS version, is there any other way to have that process silent except creating a new silent channel?
Mark M.
you should be able to just use setOnlyAlertOnce(true) on your NotificationCompat.Builder
Milan
only on builder... hm, I didn't tried that
Mark M.
this will put a flag on the notification that will cause it to only do the "alert" portion (ringtone, vibration pattern) if the notification is not already on-screen
Milan
ok, will try
thanks
Mark M.
I just added this to one of the book samples, for the next update, and it worked fine, without having to create a separate channel
Milan
I thought channel is responsible for it. Will test in a few minutes
9:55 AM
Milan
And you are supposed to keep notification object cached? To not build it again (although with same notification ID)
Mark M.
I cached the Builder, IIRC
yes, I call builder.setProgress() on the same Builder instance, then have it build() a new Notification to use with NotificationManager
where I originally set up the Builder with setOnlyAlertOnce(true)
that's the sample service -- the only thing missing is the setOnlyAlertOnce(true) call, which I added to buildForeground() in the upcoming edition
Milan
tnx, that helped me.
10:00 AM
Mark M.
glad to hear it
and that's a wrap for today's chat
the transcript will appear at https://commonsware.com/office-hours/ shortly
the next chat is Thursday at the same time -- 9am US Eastern
have a pleasant day!
Milan
has left the room
Mark M.
turned off guest access

Saturday, May 19

 

Office Hours

People in this transcript

  • Mark Murphy
  • Milan