Office Hours — Today, September 14

Saturday, September 11

Sep 14
7:50 PM
Mark M.
has entered the room
Mark M.
turned on guest access
7:55 PM
Julius
has entered the room
Julius
hi Mark
Mark M.
howdy, Julius!
Julius
you must be sick of seeing me here... :)
Mark M.
no worries
Julius
anywho... I have a couple of questions.
8:00 PM
Mark M.
fire away!
Julius
I'm trying to set the speakerPhone function on when a call starts and not having much luck. I'm using:
View paste
AudioManager mAudioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
mAudioManager.setSpeakerphoneOn(true);
I do it when the phone goes Off_HOOK
View paste
			case TelephonyManager.CALL_STATE_OFFHOOK:
Max S.
has entered the room
Julius
just wondering if you' had a loko at this bfore.
Mike R.
has entered the room
Mike R.
Hello
Mark M.
I haven't touched AudioManager yet, let alone the speakerphone feature
Max S.
Hi Mark, not sure of the protocol, will ready a question, let me know when I should ask it please. (Hello, everyone)
Mark M.
(BTW, howdy, Max S and Mike R!)
Julius
no problem thanks. I can go to the back of the queue.
Mark M.
Julius: have you used Google Code Search to see where that's being used in Android proper?
Julius
no - I should google tat term?
Mark M.
on Google Code Search, yes, with the package:android limiter
Julius
cool thanks
Mark M.
I see a snippet where the Phone app uses it
Julius
I'll try taht now
Mark M.
Max: you ducked in just ahead of Mike, so...do you have a question?
Max S.
View paste
5. About hardware/software

If I have support issues it would be helpful to get user phone information like manufacturer, model, android os, even things like battery life, ram, processor speed.  A user might not know this, so is there a good way to generate a View that displays this kind of information, to make support easier?  I can't find a way to determine the android os of the host device, nor these other items.
Mark M.
the data you want is in android.os.Build
Max S.
Great, Ill poke around that, you can move on ...
Mark M.
you can either display that info, or rig up something to upload the data, etc.
8:05 PM
Mark M.
actually, Build is only for manufacturer, model, OS versoin
er, version
the rest is actually a bit difficult to get
Max S.
I see what is good enough in there, thanks!
Mark M.
Mike R: got a question?
Mike R.
Sure do. I'm having a layout issue.
I have a data entry view that I'm laying out using a TableView. Two cells per row. The left cell is a TextView label. The right cell is an EditText
Except one of the lines has 3 widgets: A TextView for the label, a TextView for a value, and an Image Button.
it looks like this.
The issue is the line labeled "Country"
Mark M.
that's the Country line?
Mike R.
yep
As it's initially laid out, it looks ok
When I get a value in there, it usually looks ok
My problem is when the value is too long. It pushes the button right off the screen.
Mark M.
solution #1: don't support the Congo
:-)
8:10 PM
Mike R.
I wish I had a snappy come-back for that!
Here's the layout.
I've defined the TextView to be 1 line, and added an elipsis at the end
Mark M.
OK
Mike R.
I could probably get this through trial and error, but I figured I'd ask the expert.
Mark M.
well, I can think of two possibilities
the easy one to try is to have android:shrinkColumns="1" along with your android:stretchColumns="1", and hope for the best
I'm skeptical that it'll work, though
the second option is a bit more involved:
Step #1: get rid of all your layout_span="2" attributes
Step #2: Wrap your countryvalue and countrybutton in a RelativeLayout, to form a single child that goes in your 2nd column
Step #3: Set up the countrybutton to be alignParentRight="true"
Step #4: Set up the countryvalue to be alignParentLeft="true" and toLeftOf="@id/countrybutton"
that more directly expresses the rule you're seeking
yet another option would be to use a Spinner for the country choice, but I'm guessing you thought of that and passed on it for whatever reason
8:15 PM
Mike R.
I like the 2nd option. I have 240 countries in the list - the full ISO country list. Don't think a spinner would work as well.
So, I'll try option 2. It does seem to best express what I'm trying to do. Thanks Mark
Mark M.
no problem
Julius: got another question?
Julius
yes
I'm having trouble with C2DM
basically I have registered with the service, tried using the documentation on the google dev site and then used the info in the Adv book
here is where I am:
I have a button to start the process:
View paste
	mStartRegisterButton.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				C2DMessaging.register(FMPMain.this, FMPConstants.APP_REG_EMAIL);
			}
		});
APP_REG_EMAIL is the email I got back in the email from Google
View paste
From C2DMBaseReceiver I see:
        // Use a naming convention, similar with how permissions and intents are 
        // used. Alternatives are introspection or an ugly use of statics. 
        String receiver = context.getPackageName() + ".C2DMReceiver";
        intent.setClassName(context, receiver);
        
        context.startService(intent);
So I think that I need to name my Receiver C2DMReceiver in order for it to be called:
C2DMReceiver
I've tested in the emulator with Wireshark
I can see traffic going to Google setting up the SSL but for some reason it's not coming back into the application.
8:20 PM
Julius
I'm guessing that the problem is that the message is coming back but not going to the Receiver
but I can't be sure
sorry for taking so long
Mark M.
what's your manifest look like for that <receiver>?
Julius
View paste
	<receiver android:name="com.google.android.c2dm.C2DMBroadcastReceiver"
		android:permission="com.google.android.c2dm.permission.SEND">
		<!-- Receive the actual message -->
		<intent-filter>
			<action android:name="com.google.android.c2dm.intent.RECEIVE" />
			<category android:name="nz.co.juliusspencer.android.xxx" />
View paste
</intent-filter>
		<!-- Receive the registration id -->
		<intent-filter>
			<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
			<category android:name="nz.co.juliusspencer.android.xxx" />
		</intent-filter>
	</receiver>
Mark M.
something is out of sync
View paste
you said earlier "
So I think that I need to name my Receiver C2DMReceiver in order for it to be called"
Julius
ah
Mark M.
at least in my code sample, C2DMReceiver is a Service, C2DMBroadcastReceiver is a BroadcastReceiver
Julius
I have:
View paste
		<service android:name=".C2DMReceiver" />
Mark M.
OK
that lines up
Julius
which is one of your (useful) WakefulServiceIntents
(just used oen of those the other day)
Mark M.
when you do your push, are you getting a good response from the Google server?
Julius
I can't do a push as I don't have a registrationI
registrationId
it's the registration part I'm having trouble with
Mark M.
oh, I'm sorry, I misunderstood
8:25 PM
Julius
that is registration of the specific instance of the application (on the phone)
Mark M.
when you wrote: "APP_REG_EMAIL is the email I got back in the email from Google", do you mean that APP_REG_EMAIL is the Google account you used for the C2DM signup?
Julius
Google sends packets back, but they're in SSL so I can't see whether Google is happy with the registration
yes it's the senderId
sorry for not being clear
Mark M.
not sure what the problem is, then
Julius
so the manifest "looks" ok
(I think I understand the whole process)
Mark M.
I didn't have much difficulty with the registration -- all my troubles were on the actual push side
Julius
heh
Mark M.
yes, the manifest seems to line up with my example, modulo class name changes
Julius
great something to look forward too
to
right
ok I might just download your one from git and make tiny changes
Mark M.
actually, you might want to just start with it verbatim
if it works with your account, then you know your account is OK
Julius
oh yes good plan
Mark M.
:-(
conversely, if it doesn't work with your account, either your account isn't set up right, or they broke my code
Julius
:-/
heheh
It'll be me
thank you for your time
Mark M.
sure
happy to help
Max: got another question?
Max S.
Is there a good tool for analytics / metrics that I can plug into an Android App that will report anonymous usage statistics like number of times app was run, what buttons were pressed etc. It cannot display ads. Or is this something I would have to roll my own for?
Mark M.
There are a few
I've used Flurry
I think Medialets has their library available
Max S.
Cost? Any reasons you chose Flurry?
Mark M.
I suspect there's an open source implementation or two of the concept floating around
the client wanted Flurry :-)
8:30 PM
Mark M.
Flurry is fine
dan t.
has entered the room
Mark M.
Personally, I'd want to do something that routed to my own server, but I'm just paranoid that way
Max S.
OK, Ill check it out, when searching for open source flavors is "analytics" the right word to search for (I hear you with the tinfoil hat)
Mark M.
bear in mind that none of these are fully automatic -- it's more that they're logging frameworks with various amounts of graphing and such on the server side
it's not like they know automatically what events you want logged
as a bonus, though, some offer exception logging, which is always great to have to collect crash data from the field
Max S.
OK, you can move on to next question-thanks!
Mark M.
howdy, dan t!
dan t.
morning!
Mark M.
Dan: do you have a question?
Julius
(heh big dan)
dan t.
nah just lurking for now ... just started reading the books...
Mark M.
cool@
er, cool!
Mike: got another question?
Julius: got another question?
Julius
I'm good just got to learn how to use git - use svn usually
Mark M.
there's also the Download Source button, upper right
8:35 PM
Mark M.
gives you your choice of ZIP or TAR
Julius
oh thank you!
Mark M.
yeah, I wish they'd make that button red or something
not quite obvious enough IMHO
anyway...
Max: got another question?
Max S.
You know what a wi-fi pay page is? Like if you open yahoo.com in a browser while on wifi at Logan Airport and you get redirected to a page to pay for internet access? Is there a way to detect this in a webview? Its not exactly a 404--which I am also curious about how to detect--Im not sure if there is a http header associated with this kind of redirect ... and how to detect it.
Mark M.
beats me
Max S.
Do you know how to detect a 404 in a webview?
Mark M.
short of experimenting with a desktop browser and good debugging tools, I'm not sure how you'd find out
Implement a WebViewClient
I think onReceivedError() will be called on a 404
attach it via setWebViewClient() on the WebView
yeah, onReceivedError() looks like it should work
Max S.
OK, I can overload that, I already have a custom webview client to hide the URL bar, so that should be pretty easy, and I'll bring wireshark to starbucks to try and figure out the other part, thanks ... I have more if we get back to me :)
Mark M.
BTW, I'll be rather surprised if there's an industry standard for those feed-me-Seymour pay WiFi pages
Max S.
One thing I have thought of is to detect the incoming url and compare it to what I requested, you can move on, that was really helpful, thanks!
8:40 PM
Mark M.
If anyone else has a question, pipe up, otherwise we'll keep working through Max's list
Max: in the meantime, go ahead
Max S.
I am out of "easy" questions. My next one is about making a sliding container, here is a rough cut of the issue, maybe you can steer me in the best direction ...
View paste
I can't figure this out.  I have a preference icon in a view.  When pressed I would like the next View to slide up from the bottom of the screen, and when the user saves or cancels by button press I would like View 2 to slide down revealing the original screen.  This  intentionally overrides the stock android view-transition-animation to give the user the idea they are filling out a temporary preference screen and the other screen is right "behind" it.
I played around with custom animations, but the closest I could get would be screen 1 dissappears, black screen appears, screen 2 slides up.  Note that I am targeting 1.5 - 2.2, although if there is a good solution that excludes 1.5 that is OK, I just need to know the best practice for deploying an app for 1.5-2.2 that has some code sections that do not work on 1.5 (can you if statement for the platform version of local device and execute different code accordingly, or do you have to deploy separate apk's?)
Julius
(Mark: your code works - thanks)
Mark M.
um, you have a lot of stuff in there
let me ask for a few clarifications:
1. What is "a preference icon"?
Mike R.
has left the room
Mark M.
2. Is this a single activity or two activities?
Max S.
Its not important, but it is a i button (like "info"), it is an imageview with an onclick the icon is from the android source ic_menu_info_details.png, but that is neither here nor there
It is two activities (I think I confused View with Activity), but I am open to making it one if that is preferable (do I hide elements?)
Mark M.
this will be easier if you have all this in a single activity
I have an example of what you're seeking in The Busy Coder's Guide to Advanced Android Development
chapter on Animations
8:45 PM
Mark M.
I demonstrate a custom View that is a sliding panel, sliding up from the bottom and sliding back down on demand
should be relatively easy to modify to suit your needs (or, as easy as anything is with animations)
Max S.
Is it possible with multiple activities? The reason I ask is that there are many screens with this button and I think it will make the code harder to maintain if I put it all into one activity. But if I have to, I will ...
Mark M.
not really
well, change that
I'm not sure if somehow using a transparent background for the 2nd activity will help
it's not out of the question
but I've never really fussed with custom inter-activity animations, so I don't know the limits, tricks, etc.
Max S.
Have you seen that black screen problem before, based on the SDK docs I thought I set it up correctly but could not get past it.
Mark M.
without seeing it, I'm not quite sure what effect you're describing, sorry
Max S.
Ill come back Thursday with screen shots now that I have seen how well those work (code too) if the problem persists. I have one more question, its pretty easy, I think.
Mark M.
go ahead
Max S.
I recently discovered the icons in: platforms/android-1.6/data/res/drawable but very few of them have different states (pressed, etc.), any thoughts on this? Is there a good free source for icons with states, or should I use some kind of custom xml file with some color magic applied to the gray icons, or ... ?
8:50 PM
Mark M.
I am not aware of a "good free source for icons with states"
in terms of "some color magic", I think ImageView has a tint option you could play with
but that, of course, only works with ImageView
right now, the "right" answer is "hire a graphic designer"
Max S.
So is your typical use case to use graphic artist created icons? Would you say that is most common?
Mark M.
point them to the icon design guidelines, and have your checkbook handy
well, "most common" isn't to use states
there are relatively few places you gotta gotta have those
tab icons and backgrounds being two that come to mind
Max S.
Oh, that is useful! OK.
backgrounds?
Mark M.
what makes a Button look like a Button, for example, is a StateListDrawable
which in turn points to a set of nine-patch PNG files
and that's used as a background
it's why if you use android:background="#FFFF0000" to make a button red, it no longer looks like a button
Max S.
Book chapter reference for me to study up on?
Mark M.
I have a bit on StateListDrawable in a Drawable chapter in the Advanced Android book, but I need to add a lot more
Max S.
OK, that does it for me, really enjoy your books and this chat, thanks for your time!
Mark M.
sure
anyone else have any questions?
Julius
yes
quick one
Max S.
Can I get a transcript of this?
Julius
I have an application which I would like to be able to use the move to the SD Card functionality, but the application is built for 1.6. If I want to do something like this, would I need to have different versions of the code and deploy each separately?
8:55 PM
Mark M.
no, I think 1.6 will ignore the manifest attribute you would set for apps-to-SD
you will need to use the 2.2 build tools
but you can still set minSdkVersion to...ummm...4 (or whatever 1.6 is, I forget)
Julius
so am I building against 2.2 but right
ok
thanks!
Mark M.
be sure to review that list of "don't do apps-to-SD if you implement X" things
Julius
oh ok will do
dan t.
where is that list?
Mark M.
In the App Install Location page, Dev Guide tab, developer.android.com (or your docs in your 2.2 SDK)
dan t.
thx
Julius
Mark M.
I'd cite a URL, but I'm rocking this chat on my Nexus One tether, courtesy of a craptacular Internet connection at this hotel
Julius
(under Applications That Should NOT Install on External Storage - I'm guessing)
Mark M.
yup, that's it
unfortunately, it's a rather compelling list
Julius
thank you once again
yeah the first thing makes me think it's not an option
but never know
bye all
Julius
has left the room
Mark M.
any last questions?
Max S.
Will this chat log be archived somewhere or can I get a transcript now?
Its not letting me copy more than one chat item at a time :(
Mark M.
not sure if you can get a transcript from here (I can, but I'm the owner of the chat room)
9:00 PM
Mark M.
I send out links to transcripts to the cw-android Google Group
Max S.
has left the room
Max S.
Perfect, thanks and good night
dan t.
thx
gn
Mark M.
no problem!
dan t.
has left the room
Mark M.
turned off guest access

Saturday, September 11

 

Office Hours

People in this transcript

  • dan trevino
  • Julius
  • Mark Murphy
  • Max School
  • Mike Renda

Files in this transcript