Jun 6 | 9:50 AM |
Mark M. | has entered the room |
Jun 6 | 9:55 AM |
Mark M. | turned on guest access |
Damian P. | has entered the room |
Damian P. |
hi Mark
|
Mark M. |
hello, Damian!
|
Mark M. |
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
|
Damian P. |
Backup
|
Jun 6 | 10:00 AM |
Gabriele | has entered the room |
Mark M. |
hello Gabriele!
|
Mark M. |
Damian: while you are working on composing your question, let me take a question from Gabriele
|
Mark M. |
Gabriele: do you have a question?
|
Mark M. |
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
|
Mark M. |
there are no rules for where that data goes
|
Mark M. |
and who all can look at it
|
Mark M. |
so unless the data you are backing up is encrypted using a user-supplied passphrase, I would not use the Android backup service
|
Jun 6 | 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
|
Mark M. |
allow the user to create their own user ID
|
Mark M. |
you will need that anyway if you ever allow users to interact with your server through their Web browser
|
Mark M. |
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
|
Mark M. |
Gabriele: that sounds like a case for AlarmManager
|
Jun 6 | 10:10 AM |
Gabriele |
thank you
|
Gabriele |
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
|
Mark M. |
you need that anyway, as not all users will have constant Internet access
|
Mark M. |
the only time you need to worry about user identity is when it comes time to start sending data to the server
|
Mark M. |
(and, more importantly, persisting that data on the server)
|
Jun 6 | 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
|
Jun 6 | 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
|
Mark M. |
*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
|
Gabriele |
without starting it from scratch
|
Gabriele |
I don't know if there is some web service framework
|
Gabriele |
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
|
Jun 6 | 10:25 AM |
Damian P. |
no problem
|
Damian P. |
Just come up with another one...
|
Jun 6 | 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 ?
|
Damian P. |
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
|
Mark M. |
all I know is that Dianne Hackborn, who wrote the fragments system, said it wasn't supported
|
Mark M. |
and so if the author says it's not supported, it's not supported :-)
|
Mark M. |
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"
|
Mark M. |
er, "we can't guarantee that it won't blow up in the future", rather
|
Mark M. |
so, from your experiment, at least one effect is a confused FragmentManager
|
Jun 6 | 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 :-)
|
Mark M. |
my apologies for having to reschedule this one from yesterday to today
|
Mark M. |
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?
|
Gabriele |
there are too many TT
|
Mark M. |
personally, I'm a Ruby guy
|
Mark M. |
though with NodeJS, JavaScript-on-the-server has a lot of momentum
|
Gabriele |
so something like this: http://locomotivejs.org/
|
Jun 6 | 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
|
Mark M. |
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?
|
Gabriele |
thank you Damian
|
Mark M. |
I feel that they need more high-level documentation
|
Mark M. |
I cannot really tell at a glance how much this is focused on Web apps versus Web services
|
Mark M. |
and, again, while I mentioned JavaScript as an option, I have not used NodeJS for implementing a Web service
|
Jun 6 | 10:45 AM |
Gabriele |
I was thinking to python, nodejs, or something considered to be "productive"
|
Gabriele | |
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
|
Damian P. |
it's crazy ;)
|
Gabriele |
eheh
|
Jun 6 | 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!
|
Mark M. |
Damian: CWAC-Prefs stores preferences in a SQLite or SQLCipher database
|
Mark M. |
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
|
Jun 6 | 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
|
Mark M. |
and in either case, unless the user is providing the passphrase, the encryption is pretty much pointless
|
Mark M. |
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
|
Mark M. |
have a pleasant day, all!
|
Damian P. | has left the room |
Gabriele | has left the room |
Mark M. | turned off guest access |
Jun 6 | 11:20 AM |
Mark M. | has left the room |
Jun 6 | 3:55 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Jun 6 | 4:05 PM |
just t. | has entered the room |
Mark M. |
hello, um, just!
|
Mark M. |
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.
|
Jun 6 | 4:10 PM |
Mark M. |
a Service is an object
|
Mark M. |
objects do not run on threads
|
Mark M. |
methods of an object are *called* on threads
|
Mark M. |
the lifecycle methods on a Service (e.g., onCreate()) are called on the main application thread
|
Mark M. |
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.
|
just t. |
Render
|
Jun 6 | 4:15 PM |
Mark M. |
it is definitely designed to be used with desktop browsers
|
Jun 6 | 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
|
Mark M. |
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
|
Jun 6 | 4:50 PM |
just t. | has left the room |
Jun 6 | 4:55 PM |
Mark M. | turned off guest access |