Office Hours — Today, February 16

Thursday, February 11

Mark M.
has entered the room
Mark M.
turned on guest access
Refael O.
has entered the room
Feb 16
9:00 AM
Mark M.
hello Refael!
Refael O.
Hi Mark ! long time no see ;]
Mark M.
how can I help you today?
Refael O.
as always I would like to open by saying thank you so much, your book is probabbly the best thing I bought ever =]
Mark M.
I am glad that it is useful to you
Refael O.
and this office hours feature has been so useful aswell. thanks a lot for your help!
the question for today would be about content provider ;]
Mark M.
you are very welcome
Jamshaid A.
has entered the room
Mark M.
Refael: what is your ContentProvider question?
(BTW, hello, Jamshaid -- I will be with you shortly!)
Refael O.
View paste
I am using a content provider in my app, and I let other apps use it aswell,
now, I am using content observer to notify myself when changes occurs..
my problem is that I want to know if the change i'm being notified is some my own app changed in the data, or something a different app changed.

there's a boolean selfChange on the onChange method..
but it always returning false
9:05 AM
Mark M.
I have never tried using that flag
and I do not know exactly what it is about a ContentProvider and notifyChange() that would trigger that flag to be true
Refael O.
hmm, so how would you recommend I would know if it's my own change?
Mark M.
beats me
I'd try to architect your app such that you do not care who makes the cahnge
er, change
IOW, the rest of your app should treat the ContentProvider as if it were from somebody else's app, not yours
and so your own changes are not somehow "different" than changes made by others
BTW, it looks like self-change is if the change was triggered by the ContentObserver, probably with an eye towards avoiding recursion
see the ContentObserver parameter to notifyChange() on ContentResolver
and see deliverSelfNotifications() on ContentObserver
anyway, let me take a question from Jamshaid, and I will be back with you shortly
Jamshaid: your turn! do you have a question?
Refael O.
okie np
Jamshaid A.
yup
was wondering if we have the same server which provides us the services we use in our app
n also do authentication over https
does it make sense to have authorization in this case
9:10 AM
Mark M.
I am sorry, but I do not understand your question
Jamshaid A.
i am somewhat confused ..android has the accounts thing where one can have an authenticator ..enter a username password get a token n use that
but then again there is openIDconnect and oAuth
do i make sense...may be a more simple way to ask would be..whats the best way to go about having authorization and authentication in android app
we have server with https and certificate authority
Mark M.
I have no way of telling you what is 'best'
Jamshaid A.
i mean to say i am confused when i use the accounts and accountauthenticator to setup an account and get a token back
Mark M.
I have not used Android's AccountAuthenticator
Jamshaid A.
Mark M.
I know what AccountAuthenticator *is*, I just have not used it, nor have I used SyncAdapter
Jamshaid A.
do u use something else instead for this purpose? i couldnt also find it the book just curious
9:15 AM
Mark M.
I have not attempted to use servers that required authentication or authorization
hence, I have not spent any time on this problem
it is certainly a very valid area of concern, but it is not one where I can provide you with advice
Jamshaid A.
okay .the other thing i wanted to ask was regarding the printer framework.Is it correct understand that one has to always convert whats to be printed to a pdf document
Mark M.
yes
Jamshaid A.
can i send bytes instead
and in the plugin receive bytes?
Mark M.
um, only if the bytes are a PDF document
what plugin?
Jamshaid A.
one can make a plugin for a printer.And then it shows up in the printer services
in the system preferences
Mark M.
I am not aware that the plugin API is part of the Android SDK
Jamshaid A.
i mean that one
Mark M.
if it is, I have not seen it, let alone used it
ah, wait, PrintService
Jamshaid A.
yes :P
Mark M.
well, from a quick scan, on the PrintService side, you seem to get a ParcelFileDescriptor
which means, technically, that could point to anything
I do not recall a way of sending arbitrary data on the client side
and, even if there were a hook for that, no apps would be doing that
9:20 AM
Mark M.
the point of PDF is to establish a common neutral convention for all parties
since we have M apps that want to print and N print services
Jamshaid A.
in printing the standards esc and tsc are used.
but i get what you mean to say and the purprose of having a pdf i will look further into it
there is some source code to make a print plugin in the experimental code branch
Mark M.
if you are implementing a print service that arbitrary other apps can print to, you are going to need to support PDF, because that is what those apps will be sending you
if you are in a situation where you are writing the one-and-only client... perhaps the best answer is to just roll your own thing, and bypass the print framework
let me take another question from Refael, and I will be back with shortly
Refael: your turn! do you have another question?
Refael O.
no Mark that's the only question for today
Mark M.
OK, if you come up with another one, let me know
Refael O.
but I think I figured out something while talking to you
Mark M.
cool!
Jamshaid: back over to you -- do you have another question?
9:25 AM
Refael O.
View paste
for the selfChange boolean to return true I have to pass that observer in the notifyChange itself.. I didn't do that, I passed a null..
i'll check if that's my problem :)
thanks again Mark. cheers!
Jamshaid A.
have u come across any marketplaces open source other than f droid
Mark M.
no, but I have not gone looking for any
Jamshaid A.
i had questions regarding authorization but other than that i got the book you recommended so i will go through it first
i guess its the questions i had thanks
Mark M.
OK, well, if either of you come up with a question, just chime in
Jamshaid A.
i have a suggestion though or may be u can guide me ... i always find it hard to get the design files like spacing and font sizes
9:30 AM
Jamshaid A.
as i am not designer i was wondering if there be a guide to use the android spacing font sizes
9:30 AM
Jamshaid A.
is there a chapter on this topic in your book maybe i missed?
Mark M.
sorry, but I do not know exactly what "android spacing font sizes" means
Jamshaid A.
like if i want to use a dialog design used by android
in my app so that i dont have to write the themes and styles
Mark M.
:: shrug :: poke around in the Android code, find the implementation, and use it
Jamshaid A.
ok :)
9:40 AM
Refael O.
has left the room
Jamshaid A.
in android when one swipes from the top we have the settings menu where one can see the settings and turn on wifi bluetooth n so
how is it called
Mark M.
um, I forget the term for that
"quick settings", perhaps
Jamshaid A.
by the way if one were to implement something like that
one should use a framelayout any idea how can one do something liek that
Mark M.
what do you mean by "something like that"? a panel with images?
Jamshaid A.
yeah a sliding panel
Mark M.
oh, you mean the entire notification tray, then
personally, I'd use a library
that being said, the container is whatever you need it to be to lay out the contents
the sliding is just an animation applied to that container
I have an example of it in my one chapter on animations
9:45 AM
Jamshaid A.
i will look at it.
may be also the source code of android has it
but i was not sure of what component it might be part of
n where to look
Mark M.
yeah, I have never gone looking for where that sort of system-wide chrome lives
Jamshaid A.
and multi user support the ability of guest users
is it around from jellybean or was just added in lollipop?
Mark M.
tablets got that in 4.2
phones got it in 5.0
Jamshaid A.
6inch device falls in phone category then
Mark M.
that really depends on the manufacturer
Amazon considers the Fire HD 6 to be a tablet, for example
9:50 AM
Jamshaid A.
it possible to change the system themeing
like to make android 4.4 kitkat looking like android 5.0
Mark M.
not readily
and that would be a firmware thing, which is outside the scope of my expertise
but changing a bunch of apps, plus the system, to adopt a new look is unlikely to be cheap and easy
it's certainly doable, as many manufacturers have created custom "skins"
and rooted devices with the right tools (e.g., Xposed, I think) can do it
Jamshaid A.
okay i will look further but thanks if u come across the authorization and authentication
or some source where it explains it clearly
Mark M.
"it" could be a book in its own right
by which I mean, there are all sorts of possibilities, tied both to client platform and server framework
Jamshaid A.
i mean we have an android device whcih has our app
9:55 AM
Jamshaid A.
and a server for now i use the authenticator as recommended in the course on udacity by google
but nowhere it speaks about authorization and openidconnect
Mark M.
like I said, there are all sorts of possibilities, tied both to client platform and server framework
Jamshaid A.
sorry but i didnt what u mean by all sorts of possibilites in this way
Mark M.
I would imagine that there are dozens of patterns for authentication and authorization, both current and historical
even if you decided to limit the scope to only dealing with authentication and authorization of Web services, there are going to be many patterns
because there are more implementations of that sort of thing than there are people in some small countries
Jamshaid A.
u think there is a good book related to android in particular one can read
Mark M.
I have not gone looking for one
moreover, usually, the server is the one that "dictates the terms" as to what the authentication and authorization will be
10:00 AM
Mark M.
since usually that server has to serve a variety of clients (Web browser, Android app, iOS app, desktop program)
that is a wrap for today's chat
Jamshaid A.
thanks
Mark M.
the transcript will be posted to https://commonsware.com/office-hours/ shortly
the next chat is Thursday at 7:30pm US Eastern
have a pleasant day!
Jamshaid A.
has left the room
Mark M.
turned off guest access

Thursday, February 11

 

Office Hours

People in this transcript

  • Jamshaid Ali
  • Mark Murphy
  • Refael Ozeri