Office Hours — Today, October 18

Thursday, October 13

Oct 18
3:55 PM
Mark M.
has entered the room
Mark M.
turned on guest access
4:00 PM
Maria
has entered the room
Mark M.
howdy, Maria!
Maria
Just you and me again?
Mark M.
at the moment
people tend to come and go
Maria
I have you all to myself!
Mark M.
how can I help you today?
Pavan
has entered the room
Pavan
Hello
Mark M.
howdy, Pavan!
Maria
Greetings
4:05 PM
Mark M.
Maria: you arrived first, so you get the first question
Maria
Is there a way to emulate the files storage on the sdcard in the emulator?
Mark M.
sure
when you create your emulator AVD, there's an option for how big of an SD card to give it
Maria
Yes, I've seen that
but how do you create a file structure on it?
Or are you supposed to create the structure via code?
Mark M.
it will already be formatted, if that's what you mean
just as an SD card comes formatted when you buy it from the store
Maria
What if I want to copy some files onto it?
I know how to do that on the phone, but not on the emulator
Mark M.
use DDMS' File Manager, or adb push from the command line
Pavan
You have to use adb
exactly!
Maria
bummer. I don't think adb works for me. I'm using windows 7 on a 64 bit machine and I think I have a driver problem.
What's your question, Pavan?
Mark M.
there should be no drivers involved with the emulator
Maria
Ok. that does kind of make sense. when I hear adb I'm thinking "talk to the phone"
Cool.
Mark M.
adb is really more "talk to the 'droid" :-)
Maria
yes I see what you mean
Mark M.
with a phone/tablet, you need drivers on Windows
not for the emulator
Maria
I would use it to connect to the emulator instance
Mark M.
correct
OK, Pavan: do you have a question?
Pavan
My applicaiton needs a broadcast to be sent to it whenever the signal quality reaches some threshold. I setup a service that boots on startup and has a phonestatelistener with the onsignalstrengthschanged() to send the broadcast. Is this a good way to set up what I want or is there any other way?
4:10 PM
Mark M.
let's back up a step
Pavan
Sure
Mark M.
why does your application need a broadcast to be sent to it whenever the signal quality reaches some threshold?
Pavan
I need to run something if there is high signal quality
Mark M.
so you will be running something every millisecond of every day if I am sitting at home and have continuous high signal quality?
or is there a time component as well?
Pavan
Once I receive the broadcast I will decide if I have to run or just ignore the broadcast
No time component really!
Mark M.
to be blunt, that stinks
the only way to do that is your current approach, with an everlasting service
users do not like those
at all
Pavan
ok.
if there is a time component involved ?
Mark M.
let's say you wanted to do some work every hour, but only if there is good signal strength
then, you could use AlarmManager for the every-hour part, and have it start your service watching for the signal strength
once the signal strength is good, you do your work, then set the next alarm
4:15 PM
Mark M.
or just have the alarm fire every hour, though you'll need to deal with the edge case of not getting good signal within the hour
Pavan
Hmm! Got it!
Mark M.
that way, at least you're not running the service *all* the time
what you want to avoid, desperately, is getting killed with a task killer
on Android 3.1+, your code will never run again once killed, until the user manually runs an activity of yours from the launcher
Pavan
Even if I have a service running all the time with the phonestatelistener on it, how much battery would it consume?
I mean the service
Mark M.
battery should not be an issue
RAM is an issue
and, more importantly, just existing is an issue
while your service may be awesome, plenty of them are less awesome
Pavan
Hmm!
Mark M.
some users just start smacking down anything they do not recognize via a task killer
the less reason you can give them to smack you down, the better
Pavan
Correct!
Mark M.
since signal strength is only relevant for voice (AFAIK), and since you can't do anything with voice from the SDK, I'm hoping you'll reconsider this capability
let me swing back to Maria, and we can follow up after she's had a chance
Maria: do you have another question?
Pavan
Sure1
Maria
Of course!
4:20 PM
Maria
I'm just a beginner so bear with me.
I would like a make a little application that receives artwork from a server.
I'm done some web programming so that's my bias
but what would you recommend?
is webview
a good component to build everything around?
Mark M.
um
what is "artwork" from a technical standpoint?
Maria
suppose you are studying for art history final
it would be nice to select a a group like "images for final"
and then have them appear on the phone
and maybe have a way via touch to see the
artist/year/etc
Mark M.
what is "artwork" **from a technical standpoint**?
Maria
stuff you must memorize
Mark M.
JPEG?
SVG?
Maria
yes
Mark M.
MP4?
Maria
no
maybe png
Mark M.
ok, so it's images
Maria
just images
yes
Mark M.
if this will all be downloaded on demand, you could skip Android entirely and just write an HTML5 Web app
or, if you want distribution through the Android Market, go with PhoneGap
Maria
it's more for myself to learn.
Mark M.
or, write a native Android app (e.g., Gallery of ImageViews)
Maria
I am taking the art class
Mark M.
well, what do you want to learn?
Maria
right so you would suggest Gallery and ImageVies
ImageViews
trying to learn android programming!
Mark M.
if you want to learn native development, Gallery and ImageViews would be a fine starting point
Maria
would you use the alarm component you were just talking about for timing?
Mark M.
I don't see where you need timing
user launches app
user taps on image collection
you download images, display them
4:25 PM
Mark M.
user swipes gallery
user taps on images
you do something interesting there
Maria
I was thinking I would use the tap for display the right answer
is it hard to do a swipe for the next picture?
that would be logical
Mark M.
that's what Gallery is for
Maria
ok so it's easy because it's built in
great!
Mark M.
ok, let's switch back to Pavan for a bit
Pavan: do you have another question?
Maria
sound good to me
Pavan
Naa!
Mark M.
OK
it's open season now, at least until somebody else shows up
either of you can fire away with any questions
Maria
So what about caching if there's no internet? would you worry about that before starting the design or would you worry about it once the basic stuff is done?
Mark M.
no, you need to work out your data model first
Maria
ok so worry about it later?
Mark M.
no, I mean worry about it first
it is substantially different to say "I'll grab the images on the fly" and "I'll have the images locally and sync them sporadically"
or "I'll have the images locally, downloaded when the user first clicks on them"
in this case, your images are the core of your data model
Maria
I was thinking I would download them on the fly and cache them and then if there's no internet, use the local copies
Mark M.
that can work, but you'll want to set that up from the outset
Maria
I have about a 1000 images so I think it's to many to have all at once
Mark M.
depending on the image size, that may be too many in general
4:30 PM
Maria
yeah, it's fine on the server but I wouldn't want to cache that many
Mark M.
users may not want to dedicated hundreds of MB of storage to your app
Maria
exactly
Mark M.
all the more reason to work out your caching and storage strategy first
Maria
I went to Canada recently and my phone was almost a dead brick
so I'm too sensitive to the "no connection" situation
I'm using mysql to keep track of everything on the server side. Do think it might be reasonable to send/cache an sqlite version? I don't think it would take up that much space if I just limit myself to a few sets of strings and foreign keys.
Mark M.
I'm not a huge fan of using SQLite as a data interchange protocol
instead, create a Web service around your MySQL database
and have your Android app consume that service
Maria
So what I was thinking is that the sqlite would have names and dates and maybe an extra column for whether the image was in the cache or not
agreed
Pavan
has left the room
Maria
the images should be sent from the server
Pavan
has entered the room
Pavan
has left the room
Maria
The db is more for use offline.
Say you want to see pictures by Manet.
You could get what was in the cache
Mark M.
there's nothing stopping you from downloading a SQLite database, but, again, I am not a big fan of that model
Maria
which may or may not have any manet
Mark M.
for starters, it only works on devices that have SQLite
which is 100% of Android and 0% of Windows Phone, for example
that's why I recommend you develop a platform-neutral Web service interface, for querying and downloading image sets
4:35 PM
Maria
I see.
Mark M.
or, have the whole image roster as one big XML or JSON file that gets downloaded on first run
or something else that gives you more flexibility
Maria
I think this can't be an app for sale because I'm sure there are all kinds of copyright issues with serving up artwork.
Mark M.
understood
Maria
Well, I've got a lot to think about and read about.
I'm sure all be back during another office hours to give you an update and ask more questions!
Thanks for your help
Mark M.
no problem
glad to be useful
4:50 PM
Marco
has entered the room
Mark M.
howdy, Marco!
Marco
Hi Mark
can I ask you a question?
Mark M.
we only have a few minutes left, so ask quickly! :-)
Marco
ok!
Do you know some libraries to read pdf on Android? I've only found libraries, but only with GPL license
mupdf for example.. they have also a commercial license but I think it's very expensive
Mark M.
not really
4:55 PM
Mark M.
usually, you just fire off an ACTION_VIEW Intent for it
let the user choose a PDF viewer
Adobe Reader is free, for example
Marco
ok, but if it's possible I want to stay in my application
Mark M.
that's rather unusual
desktops don't "stay in the application" for viewing PDFs
Web apps don't "stay in the application" for viewing PDFs
I can think of no reason for you to "stay in the application" for viewing PDFs
Marco
yes, but my application will be a sort of ebook reader, so it's the "main" functionality
Mark M.
then you shouldn't be using PDF
use EPUB
Marco
I can read EPUB easily on Android?
Mark M.
it's just HTML
an EPUB file is a ZIPped archive with HTML, images, stylesheets, etc.
plus a few metadata files
Marco
ok
I will take a look also for this opportunity
thank you mark
Pavan
has entered the room
Mark M.
running out of time -- any last questions?
Maria
no thanks for your itme
Marco
see you next time, I don't have any other question
Pavan
Thanks!
Marco
has left the room
Pavan
has left the room
5:00 PM
Mark M.
have a pleasant day!
Maria
has left the room
Mark M.
turned off guest access

Thursday, October 13

 

Office Hours

People in this transcript

  • Marco
  • Maria
  • Mark Murphy
  • Pavan