Office Hours — Today, June 6

Tuesday, June 3

Jun 6
9:50 AM
Mark M.
has entered the room
9:55 AM
Mark M.
turned on guest access
Damian P.
has entered the room
Damian P.
hi Mark
Mark M.
hello, Damian!
how can I help you today>?
Damian P.
i have a question related to Android Back Service, give me a moment to describe my problem
Backup
10:00 AM
Gabriele
has entered the room
Mark M.
hello Gabriele!
Damian: while you are working on composing your question, let me take a question from Gabriele
Gabriele: do you have a question?
OK, when either of you have a question, go ahead
Gabriele
hi
Damian P.
i am going to create an app which communicate with my server, every user should be able to register somehow, I was thinking first to use their email using AccountPicker but then I thought about giving them generated ID on the server side, this id would be backup and restore in case app is re-installed or user clear data. Is the second approach ok for you?
Mark M.
well, I do not like the Android backup service
there are no rules for where that data goes
and who all can look at it
so unless the data you are backing up is encrypted using a user-supplied passphrase, I would not use the Android backup service
10:05 AM
Damian P.
my only concern about first option is that many users don't like to share their email, it requires permissions, while second option is convenient for them because app starts working without any signing
Mark M.
beyond that, I would only go with the generated ID if the *only* way the user will *ever* be able to access your server is via an Android app
allow the user to create their own user ID
you will need that anyway if you ever allow users to interact with your server through their Web browser
or if you want users to be able to synchronize their data across multiple devices (not all Android)
Damian P.
they will use Android app only
Mark M.
unless you have tremendous predictive skills, I fail to see how you can state that with any accuracy
Damian P.
by letting them generating ID, do you mean that I should provide them with registration form and enter login name they want and then use it?
Mark M.
yes
Damian P.
i see
Mark M.
if you want to have the server then generate a token that can be stored on the device, to bypass login requirements, that's a separate issue
Gabriele
while waiting I add my question to the queue: to keep a wi-fi connection open, I need to send a request to a server every 10 minutes, else I get disconnected (it's the university wi-fi). I'm thinking of doing this with a background service, what should I use to do it every 10 minutes?
Mark M.
and if you choose to back up that token by one means or another, that's your call
Gabriele: that sounds like a case for AlarmManager
10:10 AM
Gabriele
thank you
another thing, I suppose that many apps are using a database and they are accessing this database via a restful webservice, do you plan to add something about this in the ebook?
Mark M.
no, because it has nothing really to do with Android
Gabriele
I see
Mark M.
I cover the Android side in the Internet chapter, talking about HTTP accesses in general and some example libraries, like Retrofit, for making talking with a Web service easier
Damian P.
registration form will do the job, however it collides with one of my major principles about UI experience where I want my users to get app working and useful as soon as possible, in this app. I need to think about it. Anyway, thanks for your answer. I will drop Backup Service idea.
Mark M.
Damian: the simplest way to "get the app working and useful as soon as possible" is to make the server piece optional
you need that anyway, as not all users will have constant Internet access
the only time you need to worry about user identity is when it comes time to start sending data to the server
(and, more importantly, persisting that data on the server)
10:15 AM
Mark M.
if either of you have another question, go right ahead
Damian P.
you are right, actually I am going to communicate with the server after launching app for the first time, and then after GCM being received from the server, my intention is to give them working for the first time they launch it, anyway I don't have further questions about this topic, thanks
Mark M.
the user may not have Internet access at the point when they launch your app for the first time
Gabriele
Mark, can you advise any restful web service ebook to start?
Damian P.
of course, I will cover this
Mark M.
Gabriele: not really, as I have not read any recent books on the topic
10:20 AM
Mark M.
moreover, usually you need to pick your server environment (Google App Engine? Amazon AWS? Linux virtual server? Heroku? something else?) first
Gabriele
linux server
Mark M.
then, depending upon that choice, you can start thinking about programming languages
*then*, you get to the point where you can probably start finding books
Gabriele
the problem is that there are a lot of tutorials, but I'd like a "reusable approach"
Mark M.
sorry, but I am not certain what that means
Gabriele
as I think that all these services are similar, I'd like to reuse the code for other web services
without starting it from scratch
I don't know if there is some web service framework
to help building and managing it
Mark M.
there are dozens upon dozens of server-side Web service frameworks
Damian P.
I have another question: Do you have an experience with App Engine + Android? For my app I have decided to use App Engine because it's simple to setup. Additionally, I will use NoSQL Datastore, Images API. There will also be single web page for administrators willing to buy my app. Have you heard or seen yourself any downsides of Android + App Engine combination? When I read Google docs it sound like it's all I ever dreamed :)
Mark M.
Damian: I haven't used App Engine, sorry
10:25 AM
Damian P.
no problem
Just come up with another one...
10:30 AM
Damian P.
Recently I was playing with nested fragments in order to investigate reported issue on Android issue tracker. As you mentioned in your book nesting is possible since 4.2 or if you use support library. However, it was hard to find what it actually means. So I have tried myself to nest regular fragments(no support) on Android 4.0. I was surprised that I was able to start the app without any problem and when I removed parent fragment, the nested one layout was also removed. Then I have investigated that it works for layout itself. When I checked FramgentManager, the nested fragment was still there. So is it correct that the statement from your book actually applies to FragmentManager ?
it's more clarification, not a question
Mark M.
I do not know all of the side effects of trying to nest native fragments prior to Android 4.2
all I know is that Dianne Hackborn, who wrote the fragments system, said it wasn't supported
and so if the author says it's not supported, it's not supported :-)
but I never really tried the unsupported approach myself to see exactly what happened
Damian P.
I see, so now you know what will happen :)
Mark M.
partly, that's because, at the time, "unsupported" could easily have meant "well, it won't blow up right now, but we can't guarantee that it will blow up in the future"
er, "we can't guarantee that it won't blow up in the future", rather
so, from your experiment, at least one effect is a confused FragmentManager
10:35 AM
Damian P.
nothing else comes to my mind now, I will probably have questions after office hours :)
Mark M.
don't worry, there will be more office hours :-)
my apologies for having to reschedule this one from yesterday to today
I had a late-breaking issue that I needed to address at this time yesterday
Damian P.
no problem, I am at work anyway at that time, in Poland it's 16:38 :)
Gabriele
Mark, which language would you choose, for the web service framework?
there are too many TT
Mark M.
personally, I'm a Ruby guy
though with NodeJS, JavaScript-on-the-server has a lot of momentum
Gabriele
so something like this: http://locomotivejs.org/
10:40 AM
Mark M.
to me, that feels like a framework optimized towards serving Web pages, more so than for implementing a Web service to be consumed by client-side code
that being said, I have only about 45 seconds' of experience with this framework :-)
Gabriele
eheh
Damian P.
Gebriele: if you know java then I suggest start with this https://jersey.java.net/ implementation
Gabriele
how do you feel with http://expressjs.com/ Mark?
thank you Damian
Mark M.
I feel that they need more high-level documentation
I cannot really tell at a glance how much this is focused on Web apps versus Web services
and, again, while I mentioned JavaScript as an option, I have not used NodeJS for implementing a Web service
10:45 AM
Gabriele
I was thinking to python, nodejs, or something considered to be "productive"
Damian P.
Gabriele: If you need web service for your Android app then consider Google App Engine. It's very easy to integrate with Android, especially if you are working with Android Studio. App Engine also support Python, PHP and Go(whatever it is :))
Gabriele
yes, I'm using intellij, which is the same
Damian P.
I am using at work XCode, AppCode, Eclipse, Android Studio and Intelij at the same time :D
it's crazy ;)
Gabriele
eheh
10:55 AM
Damian P.
Mark: I am considering using your lib CWAC Prefs for my app which I mentioned at the beginning. In case i will create registration user form I have to store user's data locally, i guess that regular preferences are not ok, right?
Gabriele
thank you all, see you the next time; have a good day :)
Damian P.
bye Gabriele
Mark M.
Gabriele: see you later!
Damian: CWAC-Prefs stores preferences in a SQLite or SQLCipher database
if you elect to store a durable user ID on the device, encrypting it may or may not be needed
Damian P.
yes, I was thinking about SQLCipher
11:00 AM
Mark M.
if you store a server-generated transient token on the device, encrypting that is even less likely to be needed
and in either case, unless the user is providing the passphrase, the encryption is pretty much pointless
and that's a wrap for today's chat
Damian P.
ok, thanks a lot
Mark M.
the transcript will be posted to http://commonsware.com/office-hours/ shortly
Damian P.
Have nice day :)
Mark M.
the next chat is in five hours, which is a bit unusual, at 4pm US Eastern Time
have a pleasant day, all!
Damian P.
has left the room
Gabriele
has left the room
Mark M.
turned off guest access
11:20 AM
Mark M.
has left the room
3:55 PM
Mark M.
has entered the room
Mark M.
turned on guest access
4:05 PM
just t.
has entered the room
Mark M.
hello, um, just!
how can I help you today?
just t.
Does an android Service run on the UI thread? I did not find mention in your book. I understand that Ann intentservice runs on back ground thread.
4:10 PM
Mark M.
a Service is an object
objects do not run on threads
methods of an object are *called* on threads
the lifecycle methods on a Service (e.g., onCreate()) are called on the main application thread
an IntentService maintains a background thread, and it calls onHandleIntent() on that background thread
just t.
Thanks for the clarification. Ii am trying to use chrome bruiser tho access this chat room in my phone. It does not Renee properly on my phone.
Render
4:15 PM
Mark M.
it is definitely designed to be used with desktop browsers
4:20 PM
just t.
Are handler and messages only within the same application or can they work across applications?
Mark M.
you can create a Messenger in one application and pass it to another application, such as via an Intent extra
messages sent from the second application would then be received by the Handler in the first application
just t.
Wow. Will the messages get queued up?I didn't know
Mark M.
I have not attempted to send messages this way fast enough to determine what will happen
just t.
In other words is the message queue persistent across applications?
Mark M.
I have no idea
4:50 PM
just t.
has left the room
4:55 PM
Mark M.
turned off guest access

Tuesday, June 3

 

Office Hours

People in this transcript

  • Damian Petla
  • Gabriele
  • just thinking
  • Mark Murphy