Office Hours — Today, March 29

Thursday, March 24

Mar 29
9:55 AM
Mark M.
has entered the room
Mark M.
turned on guest access
10:00 AM
Dimitri
has entered the room
Mark M.
howdy, Dmitri!
Dimitri
hello
Mark M.
how can I help you today?
Dimitri
I am build a typical application that communicates via http (json) to a backend service.
Marco G.
has entered the room
10:05 AM
Dimitri
the data retrieve is then stored in app sqlite database in order to save roundtrips to the server and hence bandwith.
Mark M.
Dimitri: OK, keep going
(btw, howdy, Marco!)
Dimitri
First of all is there a way to store my initial database in my apk ?
Mark M.
yes, by packaging it in your assets/ directory and copying it from there on first run
Marco G.
Hi! Just taking a look how chat works, i don't have any question yet
Mark M.
however, you cannot get rid of the copy in the APK, so if it is large it takes up extra space
Marco: OK
Dimitri
how can i remove the copy in the APK?
Mark M.
you cannot remove the copy in the APK -- that is what I meant when I wrote "you cannot get rid of the copy in the APK"
Dimitri
sorry misread...
What i am doing so far is running a splash screen an loading the database from there! First time takes a while.. After that it update are rather scarse!!!
10:10 AM
fitz
has entered the room
fitz
observing today :)
Mark M.
fitz: OK (and howdy!)
Dmitri: is there more to your question?
10:15 AM
Rick
has entered the room
Mark M.
howdy, Rick!
Dimitri
I have read in different posts that splash screens should not be used hence my initial questions of keeping data. Is this the case here?
Mark M.
Dmitri: splash screens just because somebody wants a splash screen are a bad idea
Rick
Hi
Mark M.
a splash screen with some sort of "loading" message, on the first run of your app, may be necessary
(or just use a ProgressDialog)
Dimitri
Thanks
Mark M.
Rick: do you have a question?
Rick
Yes
We are writing an application that needs to pause any music while we have focus
But this has been problematic
If the user hits the home button, we need to know
Mark M.
if by "problematic" you mean "impossible", then yes, I imagine that it is problematic
Rick
so we can't just use onPause
:)
yeah, everything we have come up with results in a race condition of some sort
Mark M.
well, more directly, you cannot "pause any music"
that's simply not possible
there is no API in Android to control Pandora, or Last.FM, or Spotify, or...
Rick
we requestfocus, abandonfocus
10:20 AM
Rick
from the AudioManager
Mark M.
OK, though that only works on 2.2 and higher
Rick
yes
Mark M.
and that will only stop the music from being heard
it may not pause the music
going back to your previous point, there is really no way to detect when the user presses HOME that I am aware of
Rick
yes, my understanding is that the onChangeAudioFocus call back allows for the app to decide what to do. Pause, or lower volume..
the stock android audio player implements a pause when loosing focus.
Mark M.
but there are many applications that will not use that callback (e.g., they support earlier versions of Android)
Rick
true.. we have a focused release on a particular platform..
but if a user loads an older application this could still be a problem.
our biggest issue is that if we exit and then restart quickly then there is a race condition.
10:25 AM
Mark M.
you mean with the audio focus changes?
Rick
we abandon focus, the player then gets the call back and eventually requests the audio focus back. If we restart before the music player gets to request the audio focus then we wind up having music playing during our app.
Dimitri
Sorry, a quick question, how can i force (en) as a locale for my app. I am having problem with DatePicker Dialogs.
Mark M.
Rick: I am not sure how you can get around that
Rick
thanks..
Mark M.
though I have no idea why you would need to force a locale to get a DatePickerDialog to work
10:30 AM
Rick
Bye
Rick
has left the room
Mark M.
any other questions? we should have another person joining us shortly
Dimitri
It works however if my application only supports english i would not like a Greek user to view greek datepickers since the rest of the ui is in English...
Mark M.
ah, I see
that's interesting -- I had not thought about that
10:35 AM
fitz
Mark last week you mentioned to look at Harmony to see about a phone on wifi talking directly to a pc on same network - any other areas you can point me to look into?
Mark M.
sorry, I am short on sleep
what was the context of that discussion again?
Rob N.
has entered the room
fitz
I needs files to transfer not via cable via wifi
Rob N.
Thanks Mark, that worked
10:40 AM
Mark M.
fitz: but what was your issue?
(btw, howdy, Rob, and sorry about the email -- probably routed to your spam folder :-( )
fitz
I need certain files on cell to compare to files on PC - if updated on either the other gets the new file
Mark M.
OK, so put a Web service on the PC that can give you hashes of the files or something
Rob: since we're short on time, I'll try to multitask with your question and fitz's, so go ahead
Rob N.
I'm having issues trying to save the web page I was on in a webview when the application is paused. I've tried browser.saveState(outState) and restore state, but I return to a blank page once I leave the application. I can send you my source if that helps.
I'm trying not to have to reload the page, as it contains a good amount of data
Mark M.
Rob: rigth
er, right
I haven't tried saveState(), assuming it was impractical :-)
WebView, IMHO, is a fine reason to use android:configChanges and simply avoid the destroy/recreate cycle
fitz
ya just looking for something like RMI
Mark M.
that covers most of the cases
fitz: ah, yes, right, now I remember
Dimitri
Just tried http://stackoverflow.com/questions/4985805… however although the dialog popup is now in english the formated text (Time retTime.format("%x");) is in greek...
Mark M.
you can always go something open source (Protocol Buffers or Thrift)
Rob N.
I have ..
View paste
	public void onConfigurationChanged(Configuration newConfig) {
		super.onConfigurationChanged(newConfig);
		}
10:45 AM
Mark M.
Dmitri: I have no idea how to help with that part, sorry
Rob N.
to hadle when the keyboard slides out,
handle
Mark M.
Rob: If you're already doing that, the only place onSaveInstanceState() should come into play will be any other configuration changes you do not have listed in android:configChanges
Dimitri
thanks anywat..
Mark M.
or if the user navigates further down the stack, Android closes your activity, and the user BACK-buttons their way back to your activity
that latter scenario does not seem terribly likely in general
Rob N.
So what line do i need in my manifest besides, android:configChanges="keyboardHidden|orientation">
Mark M.
Rob: well, for orientation changes, that should be it
there are other configuration changes -- you'll find them listed in the docs
most of the other events are relatively unlikely, except perhaps the uiMode one for car/desk docks
Rob N.
ok, so I'm looking to add to my config changes any events that would destroy an activity... Sorry, relatively new to java
Mark M.
most of this is Android-specific, not really general to Java
if you need all of them, put all of them in your pipe-delimited list
Rob N.
new to both I should have said
Mark M.
the big problem with doing this is that you have to handle *all* resource changes
Android will not automatically reload any resources for any configuration change
10:50 AM
fitz
so can you point me to investigate anything process that might do something like RMI or should I look to scrap that part of our project
Mark M.
fitz: I don't know what "something like RMI" is in your mind
there is SOAP, and Protocol Buffers, and Thrift, and various REST frameworsk
Rob N.
really, I just want the webpage to stay loaded in the webview until the click the exit application button. Short of powering off the phone. Basically it's a list of address and information our field staff needs for the day. I've used your code as a starting point and figured out how to launch navigation and the camera from javascript on the page
Mark M.
er, frameworks
Rob: OK, so list all the possible configuration changes in the android:configChanges attribute
you also don't really need the do-nothing onConfigurationChanged(), since it, well, doesn't do anything :-)
Rob N.
Thanks
Mark M.
it is possible you will still have to reload the page in some circumstances (e.g., user presses HOME and leaves for a while)
that's unavoidable
Rob N.
I figured I had to have something there to handle the event even if it did nothing
10:55 AM
Rob N.
The main issue is that some of the pages rely on form input, so It's not like I can store and reload the url
Mark M.
Rob: then you may need to rethink your approach
e.g., store the form input somewhere
Rob N.
I may have to figure out how to store the variable to reload at a later time if the application...right
Mark M.
if the whole app will mostly just be this WebView, you might want to consider redoing it as a PhoneGap app
Rob N.
I keep hearing about phonegap, I guess I should look into it.
fitz
ok thanks Mark have a great day
fitz
has left the room
Mark M.
big benefit of PhoneGap is it is cross-platform, so your app will work on iPhones and such as well
and, it has hooks for the camera
Rob N.
Mark, thanks for your time, you gave me a hood starting point
Mark M.
not sure about navigation, but that might just be a plugin for the PhoneGap framework
Rob N.
hood=good
11:00 AM
Mark M.
OK, that's all for today's chat
next chat is Thursday at 4pm Eastern
have a pleasant day, everyone!
Rob N.
Thanks
Marco G.
thanks have a nice day
Dimitri
has left the room
Marco G.
has left the room
Rob N.
has left the room
Mark M.
turned off guest access

Thursday, March 24

 

Office Hours

People in this transcript

  • Dimitri
  • fitz
  • Marco Grassi
  • Mark Murphy
  • Rick
  • Rob Neumann