Office Hours — Today, May 25

Yesterday, May 24

May 25
7:25 PM
Mark M.
has entered the room
Mark M.
turned on guest access
7:30 PM
fitz
has entered the room
Mark M.
howdy, fitz!
Phil M.
has entered the room
fitz
just watching today - see if I can pick up some ideas :)
Mark M.
howdy, Phil!
OK
Phil: how can I help you today?
Phil M.
Hey, it's been a while
Alright, so I'm curious if it's possible to have too applications stored in a single apk. ie. two totally separate apps that run in their own application space
*two
Mark M.
what do you mean by "application space"?
Phil M.
running in their own application process
so one would be a constantly running service doing socket operations and the other being the UI portion of the product
7:35 PM
Phil M.
and i have a good reason for wanting to have them separate
7:35 PM
Mark M.
why would you ever want to do that?
I have never seen a manifest with two <application> elements, but I don't see in the docs where it is impossible (quick scan)
I see no value in having these in two applications, though
Phil M.
I'm trying to program around dumb users who think they need to shut down my app to exit it, thus also shutting down the service part of it
Mark M.
um, what you're asking for is unlikely to help
at least, IMHO
it's not like they can't shut down the service running separately
you're welcome to try two <application> elements and see what happens, though
Phil M.
true, but (if i'm not mistaken) service apps don't show up in the app manager
Mark M.
what "app manager"?
Phil M.
Settings->Manage application
Mark M.
of course services show up there
Phil M.
i thought they show up under running serfices
Mark M.
more accurately, all applications show up there
Phil M.
*services instead
Mark M.
no
if it is installed, it is in Manage Applications
Phil M.
oh, well then, that makes my idea mute
7:40 PM
Phil M.
guess that makes my life easier in the end
Mark M.
if you don't mind my asking, what does the service do?
Phil M.
keeps a socket connection open to send and receive asynchronous data, ie push
Mark M.
I take it C2DM isn't meeting your needs
Phil M.
need to support <2.2
Mark M.
ah, OK
in a pinch, you could try to switch to a relatively fast poll approach < 2.2 (e.g., AlarmManager every minute)
Phil M.
can't, the product is designed around push
Mark M.
ah, well
Phil M.
anyways, i have another questions
Mark M.
wish they'd've back-ported the C2DM client piece
Phil M.
that WOULD be nice
Mark M.
go ahead with other questions -- fitz, if you come up with a question, chime in
7:45 PM
Chris
has entered the room
Mark M.
howdy, Chris!
Chris
Hi
Phil M.
was just doing some review through the Services: The Theory chapter in your beginner book and i wanted to know what the dis/advantages of ListenerObjects vs Messenger objects were?
Mark M.
the Listener pattern requires binding
Messenger doesn't
Chris
Once again, I don't have a specific question :)
Mark M.
Chris: OK, if you come up with one, chime in
Chris
I did last night though and joined too late!
Mark M.
Phil: whether you consider binding to be an advantage or a disadvantage is up to you :-)
Phil M.
cool
if no one else has a question, I've got a third
7:50 PM
Mark M.
fire away
by "fire away", I meant that you could ask your question... :-)
Phil M.
ok, so I have a thread that blocks on the socket waiting for some data to come in, the phone (and thus cpu) goes to sleep, when data does come in, the cpu wakes up to let the thread read from the socket, do i need to do anything with partial wake locks?
Mark M.
I'm not sure what the rules of the game are for that scenario
Phil M.
this chat could use a "typing" status
Mark M.
with AlarmManager, Ms. Hackborn indicated that AlarmManager holds a partial WakeLock long enough for a BroadcastReceiver to do its onReceive()
there might be a similar rule for incoming mobile data packets, but I don't know what that rule is
to be safe, I'd grab a partial WakeLock
Phil M.
so the pattern would be something like: read data from socket -> grab lock -> process data -> release lock -> loop around to wait on socket again
7:55 PM
Mark M.
yes
Phil M.
cool
Chris
8I work as a technical support engineer at VMware for our vCloud product. I decided that I'm going to try to make a little android app that can connect to vCloud via its REST API and manage resources such as creating/deleting virtual machines. I created my own SSL certs using an internal CA and was having problem getting the android app to get past the cert on vCloud's web portal. I finally got past that part using some info I found online using a fake SSL factory. So far I've gotten the app to login to vCloud and list VMs. Now I'm trying to see if I can delete a VM...
Mark M.
yeah, Android support for SSL certs like that is not awesome
in part, inheriting from some Java non-awesomeness, as I recall
Chris
I got a tool call RESTClient that I can use to send commands to the API and delete VMs and that works fine. First, I have to access the login page and get back some headers. One is called x-vcloud-authorization. Then I can put this header into subsequent requests and do things like delete VMs.
yeah, I was like this SSL stuff is ridiculous.
So right now I'm just trying to build the request to delete a VM. I get the x-vcloud-authorization value and add that to the request using setHeader.
8:00 PM
Chris
For delete request, would I use HttpDelete() instead of HttpGet()? In this RESTClient program I switch the http method type over to delete and it works fine.
Mark M.
yes, if it wants an HTTP DELETE operation, HttpDelete is the class to use
each HTTP verb has its own class
Chris
cool
8:05 PM
Phil M.
On the same idea as my last question, I noticed in your(I'm assuming it was you) answer to this question: http://stackoverflow.com/questions/5007721… that you say the socket will wake the phone if it's on a mobile connection, not wifi, how would we deal with the wifi case?
Mark M.
other than keeping the device perpetually awake and on WiFi with a WakeLock and WifiLock, I am not aware of a solution here
Phil M.
hmmm, in the case where both your wifi and mobile connection are working, can you specify which to use?
Mark M.
nope
at least not with public SDK methods
it'll go to WiFi
8:10 PM
Phil M.
k, I think I'm out of questions for the time being
Mark M.
ok
8:15 PM
Mark M.
if anyone comes up with a question, chime in
Phil M.
hmmm, just tested something and it seems a socket can wake the phone on wifi
Mark M.
I was under the impression that the WiFi radio will eventually power down
Phil M.
hmm, then maybe i didn't wait long enough
Mark M.
and whenever this topic came up with Googlers, the emphasis was always on mobile data
I don't know how long the WiFi radio stays on
Phil M.
well c2dm must handle this problem somehow
Chris
Once I execute a request using "HttpResponse response = client.execute(request);" do I need to do anything to "clean up" the connection because if I try to issue another request using the same client, nothing happens. Don't see any good info in the debugger. The app just ANRs.
Mark M.
Phil: my best guess would be that the device is on briefly when they shut down WiFi, and the normal failover broadcasts occur, and C2DM switches to mobile data
but that's just a guess
Phil M.
will test, thanks
Mark M.
Chris: I haven't used HttpResponse in ages -- I usually am using a ResponseHandler
8:20 PM
Chris
Oh that's right. Like in the Weather app.
Mark M.
you need that header, so you will need HttpResponse
Chris
Oh
Well I gotta run. I'll work on this later. Thanks!
Mark M.
Chris: check the hc.apache.org docs for help with HttpResponse
Phil M.
might've had an answer for you chris had my eclipse not frozen
one sec
nvm, we didn't use httpResponse either
Mark M.
yeah, if you don't need the headers, the ResponseHandler pattern is simpler to use
Phil M.
we used a HttpUrlConnection
Mark M.
there's that too
8:25 PM
fitz
both httpResponse and HttpUrlConnection are used a bunch in new v3-atom google stuff
Phil M.
v3-atam?
*atom
Mark M.
I believe he is referring to the v3 edition of the Google Docs APIs
fitz
8:30 PM
fitz
yes sorry for typo
Phil M.
ag
ah
Mark M.
well, that's a wrap for today's chat
fitz
ok - thanks
Mark M.
two more next week, Tuesday 10am and Thursday 4pm, all times Eastern
fitz
has left the room
Phil M.
ok, have a good one, thanks for the help
Mark M.
have a pleasant day, all!
Phil M.
has left the room
Chris
has left the room
Mark M.
turned off guest access

Yesterday, May 24

 

Office Hours

People in this transcript

  • Chris
  • fitz
  • Mark Murphy
  • Phil M