Oct 18 | 3:55 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Oct 18 | 4:00 PM |
Maria | has entered the room |
Mark M. |
howdy, Maria!
|
Maria |
Just you and me again?
|
Mark M. |
at the moment
|
Mark M. |
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
|
Oct 18 | 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
|
Mark M. |
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
|
Maria |
but how do you create a file structure on it?
|
Maria |
Or are you supposed to create the structure via code?
|
Mark M. |
it will already be formatted, if that's what you mean
|
Mark M. |
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?
|
Maria |
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
|
Pavan |
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.
|
Maria |
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"
|
Maria |
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
|
Mark M. |
not for the emulator
|
Maria |
I would use it to connect to the emulator instance
|
Mark M. |
correct
|
Mark M. |
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?
|
Oct 18 | 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?
|
Mark M. |
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
|
Pavan |
No time component really!
|
Mark M. |
to be blunt, that stinks
|
Mark M. |
the only way to do that is your current approach, with an everlasting service
|
Mark M. |
users do not like those
|
Mark M. |
at all
|
Pavan |
ok.
|
Pavan |
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
|
Mark M. |
then, you could use AlarmManager for the every-hour part, and have it start your service watching for the signal strength
|
Mark M. |
once the signal strength is good, you do your work, then set the next alarm
|
Oct 18 | 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
|
Mark M. |
what you want to avoid, desperately, is getting killed with a task killer
|
Mark M. |
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?
|
Pavan |
I mean the service
|
Mark M. |
battery should not be an issue
|
Mark M. |
RAM is an issue
|
Mark M. |
and, more importantly, just existing is an issue
|
Mark M. |
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
|
Mark M. |
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
|
Mark M. |
let me swing back to Maria, and we can follow up after she's had a chance
|
Mark M. |
Maria: do you have another question?
|
Pavan |
Sure1
|
Maria |
Of course!
|
Oct 18 | 4:20 PM |
Maria |
I'm just a beginner so bear with me.
|
Maria |
I would like a make a little application that receives artwork from a server.
|
Maria |
I'm done some web programming so that's my bias
|
Maria |
but what would you recommend?
|
Maria |
is webview
|
Maria |
a good component to build everything around?
|
Mark M. |
um
|
Mark M. |
what is "artwork" from a technical standpoint?
|
Maria |
suppose you are studying for art history final
|
Maria |
it would be nice to select a a group like "images for final"
|
Maria |
and then have them appear on the phone
|
Maria |
and maybe have a way via touch to see the
|
Maria |
artist/year/etc
|
Mark M. |
what is "artwork" **from a technical standpoint**?
|
Maria |
stuff you must memorize
|
Mark M. |
JPEG?
|
Mark M. |
SVG?
|
Maria |
yes
|
Mark M. |
MP4?
|
Maria |
no
|
Maria |
maybe png
|
Mark M. |
ok, so it's images
|
Maria |
just images
|
Maria |
yes
|
Mark M. |
if this will all be downloaded on demand, you could skip Android entirely and just write an HTML5 Web app
|
Mark M. |
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
|
Maria |
ImageViews
|
Maria |
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
|
Mark M. |
user launches app
|
Mark M. |
user taps on image collection
|
Mark M. |
you download images, display them
|
Oct 18 | 4:25 PM |
Mark M. |
user swipes gallery
|
Mark M. |
user taps on images
|
Mark M. |
you do something interesting there
|
Maria |
I was thinking I would use the tap for display the right answer
|
Maria |
is it hard to do a swipe for the next picture?
|
Maria |
that would be logical
|
Mark M. |
that's what Gallery is for
|
Maria |
ok so it's easy because it's built in
|
Maria |
great!
|
Mark M. |
ok, let's switch back to Pavan for a bit
|
Mark M. |
Pavan: do you have another question?
|
Maria |
sound good to me
|
Pavan |
Naa!
|
Mark M. |
OK
|
Mark M. |
it's open season now, at least until somebody else shows up
|
Mark M. |
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
|
Mark M. |
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"
|
Mark M. |
or "I'll have the images locally, downloaded when the user first clicks on them"
|
Mark M. |
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
|
Oct 18 | 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
|
Maria |
so I'm too sensitive to the "no connection" situation
|
Maria |
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
|
Mark M. |
instead, create a Web service around your MySQL database
|
Mark M. |
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
|
Maria |
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.
|
Maria |
Say you want to see pictures by Manet.
|
Maria |
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
|
Mark M. |
which is 100% of Android and 0% of Windows Phone, for example
|
Mark M. |
that's why I recommend you develop a platform-neutral Web service interface, for querying and downloading image sets
|
Oct 18 | 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
|
Mark M. |
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.
|
Maria |
I'm sure all be back during another office hours to give you an update and ask more questions!
|
Maria |
Thanks for your help
|
Mark M. |
no problem
|
Mark M. |
glad to be useful
|
Oct 18 | 4:50 PM |
Marco | has entered the room |
Mark M. |
howdy, Marco!
|
Marco |
Hi Mark
|
Marco |
can I ask you a question?
|
Mark M. |
we only have a few minutes left, so ask quickly! :-)
|
Marco |
ok!
|
Marco |
Do you know some libraries to read pdf on Android? I've only found libraries, but only with GPL license
|
Marco |
mupdf for example.. they have also a commercial license but I think it's very expensive
|
Mark M. |
not really
|
Oct 18 | 4:55 PM |
Mark M. |
usually, you just fire off an ACTION_VIEW Intent for it
|
Mark M. |
let the user choose a PDF viewer
|
Mark M. |
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
|
Mark M. |
desktops don't "stay in the application" for viewing PDFs
|
Mark M. |
Web apps don't "stay in the application" for viewing PDFs
|
Mark M. |
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
|
Mark M. |
use EPUB
|
Marco |
I can read EPUB easily on Android?
|
Mark M. |
it's just HTML
|
Mark M. |
an EPUB file is a ZIPped archive with HTML, images, stylesheets, etc.
|
Mark M. |
plus a few metadata files
|
Marco |
ok
|
Marco |
I will take a look also for this opportunity
|
Marco |
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 |
Oct 18 | 5:00 PM |
Mark M. |
have a pleasant day!
|
Maria | has left the room |
Mark M. | turned off guest access |