Office Hours — Today, May 24

Tuesday, May 22

May 24
8:50 AM
Mark M.
has entered the room
8:55 AM
Mark M.
turned on guest access
midas
has entered the room
9:00 AM
Mark M.
hello, midas!
how can I help you today?
midas
hey mark
I have a few questions
one is about single activity architecture
I wouldnt ask
but from what I understood from io 18
google is now recommending this and is pushing it with the navigation arch component
Mark M.
yes
midas
anyway, I was wondering if one screen can have a tab layout and another not in this framework
since the tabs are part of the app bar layout
which is an activity level ui
or am I making a fundamental error somewhere?
Mark M.
some design choices may force you into using separate activities
Milan
has entered the room
Mark M.
just because Google steers you towards a single activity does not mean that you necessarily have to use a single activity for everything
(BTW, hello Milan -- I will be with you shortly!)
Milan
(hello Mark, no prob :) )
midas
I agree with that, just find it strange, since one screen having tabs is not that uncommon
how useful can navigation be if it cant handle tabs?
Mark M.
well, tabs do not necessarily have to be in the app bar layout
midas
thats true, unless you want them to collapse with the app bar per material design
Mark M.
and I think Google is leaning more towards bottom navigation
9:05 AM
midas
which are not supposed to be swipeable tabs
anyway that was the first question
Mark M.
let me take a question from Milan, and then I can return to you for your next question
Milan: your turn! do you have a question?
Milan
feel free to finish with midas
Mark M.
OK
midas: back to you! what's your next question?
midas
ok, thanks milan. The other is about connecting to a wifi enabled device (like a camera w/o data) and remaining connected to mobile network
are you aware of anyway to do that?
Im finding myself forced to manually switch back and forth
Mark M.
IIRC, newer versions of Android offer some ability to control which network connections go on WiFi and which go on mobile data
but I have not spent any time with that problem
midas
IIRC ?
Mark M.
"if I recall correctly"
midas
ah
but can I stay connected to both at the same time?
Mark M.
my understanding is: yes
but, I do not know the details
midas
but you dont know specifically how, or which apis to look at
ok thanks anyway
Mark M.
I'd start with ConnectivityManager, but otherwise no
look in the release notes for Android 7.0-8.0
midas
will do
Mark M.
I think this showed up around there
midas
thanks
Mark M.
the capability has been around for quite a while, as there are nasty hacks on Stack Overflow using hidden APIs related to this
midas
well wifi hotspots were around much longer
Mark M.
it's only in recent versions that they made it official and supported
yes, though I think what you are asking for has also been possible
9:10 AM
Mark M.
anyway, again, I don't recall the details, as it's not an area that I have worked in directly or spent much time on
so, I can offer you hope, but not much more
midas
ha!
thanks mark
Mark M.
midas: do you have another question? if not, I'll turn it over to Milan
midas
nope thats it for me
Mark M.
OK
Milan: your turn! again! :-)
Milan
My notification is playing a ringtone. With the channels, it is not possible to change a ringtone from application. The only thing I could do is to point user to the settings of specific channel. However, clicking on sound there lists a short tones, not ringtones.
Any way to force that screen to list ringtones instead?
Could I share a small piece of code with you to discuss it?
Mark M.
you can, though I am uncertain if it will help
Milan
Mark M.
I am not aware of any ability to control what Settings offers here
Milan
I thought it would be possible by .setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE)
however, same result as with .setUsage(AudioAttributes.USAGE_NOTIFICATION)
Mark M.
hmmm...
Milan
broken api?
Mark M.
what version of Android are you testing on?
Milan
8 and above
Mark M.
I ask, because I just brought up my SAW Monitor app's page in Settings, for my "Whatever" channel
Milan
8.0 currently
9:15 AM
Mark M.
when I tap on "Sound" -- where my channel just opts into the default -- I get a chooser for picking an audio file
Milan
you mean + Add ringtone option?
Mark M.
no, just a file chooser
so, I tap on "Sound", the chooser shows up, and I can choose a file
presumably, it's scoped to audio files via the MIME type
this is on a Nexus 5X running 8.1
Milan
all I got is pre-populated list of short tones and Add ringtone option
Mark M.
so I am seeing the opposite of you: I don't have short tones or canned ringtones, but I can choose an arbitrary media file
what device?
Milan
mine 5.x on 8.9
8.0
5x
Mark M.
whew, you had me scared there for a moment :-)
Milan
:D
Mark M.
note that you have two setSound() calls in your not-a-chromebook branch of code
Milan
first one is commented out
Mark M.
oh, right, sorry
Milan
shared by mistake
Mark M.
FWIW, my SAW Monitor app's notification is: https://github.com/commonsguy/cw-omnibus/blob/v...
I'm just using setDefaults(Notification.DEFAULT_ALL)
I am surprised that Settings behaves differently here for what the user can choose in the channel settings
9:20 AM
Milan
5X and some devices have +Add ringtone options from that settings screen / sound
Pixel 2 does not have such option
not the Samsung devices with 8 and above
EMUI does not have Sound option at all
Mark M.
hence, this is more of a Settings issue than a notification API issue, most likely
Milan
I would say so
Mark M.
perhaps someday Google will establish and enforce some requirements, though that won't necessarily help with the EMUI case
but I really doubt that there is much that you can do, in your app, to force consistent behavior
Milan
don't care for EMUI at the momment but wondering why it is different on Pixel 2
Mark M.
because Google changed their mind, presumably
Milan
+Essential PH-1 with stock ROM has +Add ringtone option
8.1
Mark M.
whereas the Nexus devices were a fairly pure AOSP experience, Google is making the Pixels be more Googly
Milan
Pixel 2 has prepopulated list of alarm tones, onlu
only
so you think there is no way to force that list to show ringtones instead of alarm tones?
Mark M.
I doubt it
and if there is a way, I have no idea what it would be
Milan
what is the purpose of AudioAttributes::setUsage then?
Mark M.
to be honest, I have never tried that
9:25 AM
Milan
:) ok
I guess that is all, then
Mark M.
sorry that I did not have a solution for you
Milan
no prob
I am just wondering were the notifications good choice for playing ringtone, after all
before the channels - absolutely yes, I would say
now, I am not so sure
Mark M.
if the audio is tightly tied to the notification, then I'd say yes, and "let the chips fall where they may" on configurability
if the audio is not tightly tied to the notification, and you're willing to offer your own UI for configuring the rules for playing the audio, then perhaps playing it yourself directly makes more sense
Milan
I have both notifications and UI, UI is displayed when the screen is locked only
nut main idea is to have notification responsible to answer/decline the call, and that way no need to have activity in fg
Mark M.
your use case is fairly unusual, so managing ringtones yourself seems reasonable
9:30 AM
Mark M.
though you may wish to explore setting up your own rules for DND, etc., if you do not have them already
Milan
why you think it is unusual?
Mark M.
most apps using notifications are not handling incoming calls
and the term "ringtone" originated with the concept of incoming calls
Milan
I have no option to unlock the screen with notification, especially if user forbid that via channel setting, so I have to provide UI for answering the call, too
agree and not agree :) most popular messengers have a heads up notificaton
Mark M.
and there are, what, 10 popular messenger apps, out of millions of Android apps?
Milan
true
Mark M.
in your particular product area (call managers), your requirements may be typical
but over the entire Android app space, your requirements are unusual
Milan
with user base bigger than other messanger apps
Mark M.
unusual != bad
Milan
Ah I see what you try to say
make sense
Mark M.
but unusual does mean that Google's changes may harm you more than it does the average app
and so you may need to get... creative
such as playing the ringtone yourself
Milan
and taking care of DND, native calls and all similar stuff by yourself
Mark M.
yes
9:35 AM
Mark M.
for your product category, my feeling is that those steps are necessary and reasonable
but if I'm writing a fitness app, and I want to remind the user that they are still 6,349 steps short of their 10,000 for the day, I should not be playing the ringtone myself
Milan
I hoped that AudioAttributes was step forward in direction to minimize developer interfirence
with the system
Mark M.
well, bear in mind that the AudioAttributes version of setSound() was introduced in Android 5.0
so, when they added it, they may not have been thinking about the sorts of user-managed channels that were introduced with Android 8.0
Milan
hm, good point
lets create them a ticket and give an idea to Google devs :)
thanks for your time
Mark M.
happy to (try to) be useful!
Milan
has left the room
Mark M.
midas: if you have another question, go ahead!
9:40 AM
midas
nope just listening
Mark M.
no problem
midas
I was hoping to find some more info about the question I had asked
but no success
I was thinking that I might need another process
and use IPC
Mark M.
it's older than I thought -- showed up in 5.0
now, I have not attempted to use this, and it may be that this is not what you're looking for, but it is what I thought of with respect to your problem
10:00 AM
Mark M.
that's a wrap for today's chat
the transcript will be posted to https://commonsware.com/office-hours/ shortly
the next chat is tomorrow at the same time, 9am US Eastern
have a pleasant day!
midas
has left the room
Mark M.
turned off guest access

Tuesday, May 22

 

Office Hours

People in this transcript

  • Mark Murphy
  • midas
  • Milan