Aug 14 | 7:20 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Aug 14 | 7:25 PM |
Gaurav B. | has entered the room |
Mark M. |
hello, Guarav!
|
Mark M. |
how can I help you today?
|
Aug 14 | 7:30 PM |
Jeff | has entered the room |
Mark M. |
hello, Jeff!
|
Jeff |
hi Mark
|
Mark M. |
Jeff: do you have a question?
|
Jeff |
both your suggestions yesterday worked well -
Thanks. I'm getting ready to put my first app in the Play Store. I'm
using Crittercism for crash tracking and I have beta users. any other
advice on how to ensure stability once the code is in the store?
|
Mark M. |
um, pray to the deity of your choice?
|
Mark M. |
:-)
|
Mark M. |
testing is key
|
Jeff |
I realize it's a vague question but I wanted to see if you had any input
|
Mark M. |
the more testing, the better, in general
|
Jeff |
yes, I'm lining up some beta users to try things I wouldn't think of
|
Jeff |
Ok - Have a good night
|
Mark M. |
in addition to what you can test locally, there are services like Apkudo that can test on a suite of devices
|
Mark M. |
Guarav: do you have a question?
|
Aug 14 | 7:35 PM |
Mark M. |
if anyone has a question, chime in
|
Aug 14 | 7:40 PM |
Ollie | has entered the room |
Mark M. |
hello, Ollie!
|
Mark M. |
Ollie: do you have a question?
|
Ollie |
Hello there
|
Ollie |
I don't have it all gathered up yet so I can wait a bit
|
Ollie |
Actually, it might be easy...
|
Ollie |
Can you point me at the best place to show me how to fragment correctly
|
Ollie |
I just feel I am using more classes than I should need to
|
Mark M. |
I am afraid that I do not understand your question
|
Mark M. |
um, can you give me an example?
|
Ollie |
Lets say I have an app with three activites. When you click a button on one you go to another activity.
|
Aug 14 | 7:45 PM |
Ollie |
I should be able to utilize the same fragment to
show the next one, instead I am using a new fragment simply because I am
kinda screwed up with it lol
|
Mark M. |
do you mean that you are using the same UI structure in both places?
|
Ollie |
Yes sir
|
Mark M. |
OK, then, you have two main options:
|
Mark M. |
#1: stick with separate fragment classes, but use inheritance to reduce code duplication
|
Mark M. |
#2: consolidate the two fragments into one, teaching it how to deal with data from both places
|
Ollie |
Answer #2 is what I am looking for a good guide on
|
Mark M. |
well, there really isn't a great "guide" for that, only because there's an infinite number of combinations
|
Ollie |
Got ya
|
Mark M. |
where is the data coming from, in each case?
|
Ollie |
I am going to be pulling from a website via REST
|
Mark M. |
and... each case uses a different URL?
|
Ollie |
Correct
|
Mark M. |
OK
|
Mark M. |
if you use dynamic fragments
(FragmentTransaction), you can create the fragment instances yourself,
typically using a factory method (e.g., newInstance())
|
Aug 14 | 7:50 PM |
Mark M. |
in that case, you can pass into the factory method the URL for this specific *instance* of the fragment
|
Ollie |
ok
|
Mark M. |
the factory method would stuff that into the arguments Bundle, as I showed in the ViewPager samples
|
Mark M. |
and the fragment instance would then retrieve that
value to use when kicking off the AsyncTask (or whatever) for doing the
REST call
|
Mark M. |
using the arguments Bundle ensures that you have the data again after a configuration change
|
Mark M. |
if the data structure retrieved from the REST call
is the same (just with different values), use a single AsyncTask (or
whatever), otherwise use two
|
Ollie |
ok coolio, then I will be reviewing your ViewPager samples too
|
Ollie |
Much appreciated
|
Mark M. |
no problem
|
Mark M. |
Guarav & Jeff: do either of you have a question?
|
Aug 14 | 7:55 PM |
Ollie |
My goal would be to have the app sort of like a
wordpress page. Where the "theme" is the same, and the data can quickly
be updated via pulling info off the web.
|
Mark M. |
that's a question of decoupling the view and
controller logic (display and input events) from your model and how you
retrieve your model
|
Chrystian | has entered the room |
Mark M. |
hello, Chrystian!
|
Chrystian |
Hello
|
Mark M. |
Chrystian: do you have a question? it's your turn
|
Chrystian |
I have to develop an app for a customer. The app
needs to start on 5 devices(same hardware) simultaneously, can I rely on
android's time implementation? I think I could also use gps time, but
that may not work inside buildings.
|
Aug 14 | 8:00 PM |
Mark M. |
if the devices are all using network time (e.g., NITZ from cell providers), they'll be decently accurate
|
Jeff | has left the room |
Mark M. |
how "simultaneous" do you need? Android isn't a RTOS
|
Chrystian |
the devices will be gsm, but they will not have service.
|
Chrystian |
within 100 ms
|
Mark M. |
that's not going to be possible with each of them operating independently
|
Mark M. |
maybe if they are all listening on open sockets to some server that can send a "go!" signal
|
Chrystian |
yes, that is what I was thinking
|
Chrystian |
can I implement NITZ if the device has no service?
|
Mark M. |
not unless you are a billionaire and are going to set up your own mobile carrier :-)
|
Mark M. |
I don't think apps can set the system time (e.g., run your own SNTP client), but that's at least worth investigating
|
Chrystian |
haha, OK. No, they cant, I looked that up earlier
|
Chrystian |
thank you.
|
Mark M. |
yeah, then, some sort of synchronized signal (WiFi, Bluetooth, maybe USB) will be your best shot
|
Aug 14 | 8:05 PM |
Chrystian |
Ok, thanks.
|
Mark M. |
Ollie & Guarav: do either of you have a question?
|
Ollie |
Not at the moment
|
Ollie |
Eventually though I will be having questions about using the "new" location services
|
Mark M. |
I have some material on LocationClient in the book, for basic location lookups
|
Mark M. |
haven't gotten to geofencing yet
|
Ollie |
When that happens I will be bugging you some more
|
Mark M. |
OK
|
Mark M. |
Chrystian: do you have another question?
|
Chrystian |
no, that was it.
|
Aug 14 | 8:10 PM |
Mark M. |
OK, well, if anyone comes up with a question, chime in
|
Gaurav B. | has left the room |
Yurii L. | has entered the room |
Mark M. |
hello, Yurii!
|
Mark M. |
Yurii: do you have a question?
|
Yurii L. |
Hi Mark, quick question, how doesn't Retrofit works with orientation changes?
|
Yurii L. |
*does
|
Mark M. |
AFAIK, they're using AsyncTask under the covers
|
Mark M. |
but I haven't really looked
|
Aug 14 | 8:15 PM |
Yurii L. |
Cool thanks, then I should evaluate RoboSpice.
|
Mark M. |
I have not attempted to get a Retrofit call to span a configuration change, and so I do not know the precise behavior
|
Mark M. |
if anyone has a question, chime in
|
Yurii L. |
Sending multiple attachments from internal storage on Android 14+
|
Yurii L. |
to Gmail or other mail client
|
Mark M. |
I haven't done it
|
Mark M. |
I think there's ACTION_SEND_MULTIPLE for that scenario
|
Mark M. |
though the attachments would have to be served by a ContentProvider or made world-readable
|
Yurii L. |
but with FLAG_GRANT_URI_PERMISSION world readable setData takes only one Uri
|
Mark M. |
presumably, the attachments would need to be world-readable via the ContentProvider as well
|
Yurii L. |
world-readable not an option. have content provider
|
Mark M. |
you could cook up some sort of one-time Uri approach to limit others' ability to read the data later
|
Aug 14 | 8:20 PM |
Mark M. |
but, again, it's not a scenario that I have investigated
|
Yurii L. |
interesting idea, any links for one-time uri?
|
Mark M. |
nope, just a brainstorm
|
Mark M. |
basically, use random numbers (e.g., content://authority/one_time/NNNNNN)
|
Mark M. |
have a HashMap tying number to underlying file
|
Mark M. |
once the number is used, remove it from the HashMap
|
Mark M. |
there could be hiccups with this approach, such as configuration changes in the other app causing it to want to re-read the Uri
|
Mark M. |
so it might need to be more time-based than one-time-use
|
Aug 14 | 8:25 PM |
Yurii L. |
Thanks, have a good day
|
Mark M. |
you too!
|
Mark M. |
if anyone has a quick last question, go ahead
|
Ollie |
I think I am good for the night
|
Mark M. |
well, that's a wrap for today's chat
|
Mark M. |
the transcript will appear on http://commonsware.com/office-hours/ shortly
|
Mark M. |
the next chat is tomorrow, 10am Eastern
|
Mark M. |
have a pleasant day, all!
|
Ollie |
You too
|
Aug 14 | 8:30 PM |
Ollie | has left the room |
Chrystian | has left the room |
Yurii L. | has left the room |
Mark M. | turned off guest access |