Dec 27 | 7:25 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
David B. | has entered the room |
Dec 27 | 7:30 PM |
David B. |
Good evening.
|
Mark M. |
howdy, David!
|
Mark M. |
how can I help you today?
|
David B. |
First of all, love the book and the code. Thanks.
|
Mark M. |
thanks!
|
David B. |
I do have a question regarding viewpager within actionbar tabs
|
jwandroid33 | has entered the room |
Mark M. |
David: go ahead
|
jwandroid33 |
Hello
|
Mark M. |
(jwandroid33: hi! I'll be with you shortly!)
|
jwandroid33 |
ok
|
David B. |
I have an application with multiple activities, some of which include a fairly deep hierarchy of fragments.
|
David B. |
I'm looking to implement the tabhost under ABS,
and need to figure out how to move the first fragement of each of these
activities into tabs.
|
Mark M. |
FWIW, I'm not a fan of action bar tabs, simply because they are not always presented as tabs
|
Mark M. |
they can convert into a drop-down list at Android's whim
|
Mark M. |
I'd rather go with PagerTabStrip or an indicator from ViewPagerIndicator
|
Mark M. |
but, then again, I
|
David B. |
Currently, all the fragments within an activity
talk to each other via the activity (listeners). My question is,
architecturally, should I embed activities in the pages of a view, or
move the fragements into the main activity.
|
David B. |
I'm also ok with viewpagerindicator
|
Mark M. |
I recommend aversion therapy (e.g., electro-shock) to stop developers from using the phrase "embed activities" :-)
|
Dec 27 | 7:35 PM |
David B. |
:-)
|
Mark M. |
that is never the right answer, and has been deprecated for nearly two years besides
|
Mark M. |
your fragments ideally should not care what activity *class* hosts them, only that the host implements some interface
|
Mark M. |
in which case, just make sure your main activity implements that interface, and you should be good to go
|
David B. |
Ok, that makes sense. I have the interfaces built
and implemented in individual activities. I would move these all to
the main activity and just use fragments within the pages of the
viewpager.
|
Mark M. |
whether "move" is the right verb, I can't say, but otherwise that sounds fine
|
Mark M. |
let me take a question from jwandroid33, and I'll be back to you shortly
|
jwandroid33 |
Ok
|
David B. |
Cool
|
Mark M. |
jwandroid33: do you have a question?
|
jwandroid33 |
Yes. I have two but I only want general response
|
jwandroid33 |
I am trying to ascertain if it is possible to
perform peer 2 peer communications between two Android phone with no
intermediate server over the cellular network
|
Mark M. |
probably not
|
jwandroid33 |
Thats what I thought
|
Mark M. |
usually, over a cellular network, you are behind a NAT
|
jwandroid33 |
just wanted to check.
|
jwandroid33 |
yeah
|
Mark M. |
and therefore you have no ability to talk directly to another device
|
jwandroid33 |
ok
|
jwandroid33 |
I can wait for David or I can ask my second question
|
Dec 27 | 7:40 PM |
jwandroid33 |
?
|
Dec 27 | 7:40 PM |
David B. |
go ahead
|
Mark M. |
well, that was quick, so let's knock out your second one :-)
|
jwandroid33 |
Ok
|
Mark M. |
jwandroid33: go ahead
|
jwandroid33 |
My second question is can I use openRTSP from say my laptop and stream MP4 video to my table using rtsp with basic Android
|
Peri H. | has entered the room |
jwandroid33 |
over WIFI
|
Mark M. |
(howdy, Peri -- be with you shortly!)
|
Peri H. |
Hello Mark, Let me know when it's my turn.
|
Mark M. |
jwandroid33: I have no idea
|
jwandroid33 |
good enough
|
Mark M. |
I have not used RTSP with Android
|
jwandroid33 |
OK. If I succeed I will let you know :-)
|
Mark M. |
I know Android supports it, and so in theory it should work
|
jwandroid33 |
Ok
|
Mark M. |
but, in theory, lots of things should work with Android's multimedia, and don't
|
scottt | has entered the room |
jwandroid33 |
LOL
|
jwandroid33 |
:-)
|
jwandroid33 |
true
|
jwandroid33 |
I'm good then. Talk to you soon
|
Mark M. |
OK
|
Mark M. |
Peri: do you have a question?
|
jwandroid33 |
Thanks
|
Peri H. |
Yes, I have three. Here's the most pressing.
|
Peri H. |
I have a db file. We've talked about this before, and I took your advice and moved it to internal storage.
|
Peri H. |
The problem is how to handle upgrades.
Particularly, my free app comes out first. Later I'll want to release a
pro and charge for it.
|
Peri H. |
I understand that once an app is free, you can never charge for it. Thus, the pro needs to have a different package name.
|
Peri H. |
So, the problem is how to persist the db.
|
Dec 27 | 7:45 PM |
Peri H. |
One solution I thought of is to have a third app
which does nothing and holds a package name for the sole purpose of db
persistence.
|
Mark M. |
yuck
|
Peri H. |
Then the other apps can use the shared user id and access the db. I got that to work.
|
Peri H. |
Ok, what's your suggestion. I agreee, yuk.
|
Mark M. |
that depends
|
Mark M. |
let's say that on Monday, I install the free app and use it
|
Peri H. |
I was going to say, got it to work, but don't know how to launch an app with two packages.
|
Mark M. |
then on Tuesday, I decide to spring for the pro app, and start to use it
|
Mark M. |
presumably, on Tuesday, I will want the pro app to be able to work with the data that I had put into the free app
|
Peri H. |
No problem so far - the paid app can be used as an "unlocker".
|
Mark M. |
but, if on Wednesday, I go into the free app (which I did not uninstall)... what happens?
|
Mark M. |
does the free app detect that the pro app is installed and redirect over to it?
|
Mark M. |
does the free app work with the same data that the pro app does?
|
Peri H. |
Right, but if the pro version is an unlocker, then
the user would continue to run the free package. However, I guess I
still need to know how to install two packages at the same time.
|
Peri H. |
At the moment I have just the free. I can imagine
though at some point, there will be features and data the the pro will
add to the db that the free version won't be able to handler.
|
Mark M. |
does that mean that the pro version, on Tuesday, will effectively "fork" the data, and have its own copy?
|
Mark M. |
with the additional columns, tables, etc.?
|
Peri H. |
Anyway, what's the right way to do this? I want a
free version, then a series of paid versions over time. That is, the
first version might cost $2, the second $5, the third $10, the fourth
$100 :)
|
Mark M. |
well, there is no single "right way"
|
Dec 27 | 7:50 PM |
Peri H. |
I don't want to fork data. Ultimately, it could be quite large.
|
Peri H. |
Or, waht do you mean by fork?
|
Mark M. |
have an independent copy
|
Peri H. |
No, just one copy./
|
Mark M. |
OK
|
Peri H. |
Android doesn't make this easy :(
|
Mark M. |
it has little to do with Android
|
Mark M. |
and everything to do with deciding on a business model before writing any code
|
Mark M. |
you need to decide what happens to the free app once the pro app is installed
|
Mark M. |
the pro app cannot be just an "unlocker" if it is adding functionality that the free app does not happ
|
Mark M. |
er, have
|
Peri H. |
Ok, my ideal perference is that the free becomes the pro.
|
Mark M. |
"becomes"?
|
Peri H. |
That's not allowed, so the next best thing would be to install a pro and have the free automatically disappear.
|
Mark M. |
meaning, the free app has the pro functionality, and the pro is truly an unlocker?
|
Mark M. |
you cannot uninstall the free one truly automatically
|
Peri H. |
"becomes" - it's an upgrade of the same package; not allowed.
|
Mark M. |
well, that depends
|
Mark M. |
the "unlocker" strategy says that you really only have one app
|
Mark M. |
it is distributed as free but has the pro functionality, just disabled
|
Mark M. |
when the user buys pro (or, better yet, uses an in-app purchase), you "unlock" the pro features
|
Peri H. |
The unlocker approach is not my preferred solution - it's just that others are using it.
|
Mark M. |
in-app purchases to unlock app capabilities is pretty darn popular nowadays, from what I can tell
|
Peri H. |
Right, I get that.
|
Peri H. |
I don't have the functionality for the pro version yet.
|
Mark M. |
all the more reason to not have a separate pro app
|
Peri H. |
So, please elaborate on in-app purchases.
|
Mark M. |
have one app and use in-app purchases to unlock pro functionality
|
Dec 27 | 7:55 PM |
Peri H. |
Is that pretty easy to do?
|
Peri H. |
I mean,
|
Peri H. |
I mean, am I safe to launch with the free version,
then offer a free upgrade that includes code to do an in-app purchase
for the pro functionaltiy?
|
Mark M. |
AFAIK, yes
|
Peri H. |
OH, cool!
|
Mark M. |
but I am not an expert on in-app purchasing terms and conditions
|
Mark M. |
nor am I a lawyer
|
Peri H. |
I can deal with that later, then.
|
Mark M. |
right
|
Peri H. |
Well, are you saying that google might not allow it?
|
Mark M. |
more importantly, from an architecture standpoint, you don't have to fuss with two apps trying to access one data store
|
Mark M. |
again, AFAIK, what you are describing is perfectly fine
|
Peri H. |
Your last comment is right on.
|
Mark M. |
but I am not an expert on in-app purchasing terms and conditions
|
Mark M. |
I haven't even read them
|
Mark M. |
as I don't use in-app purchasing
|
Peri H. |
Ok, that's enough on this question. I'll deal with it in Jan or Feb.
|
Mark M. |
from what I see being done, it should be fine, but I can't vouch for it
|
Mark M. |
OK, I'll be back with you in a bit
|
Mark M. |
scottt: do you have a question?
|
Mark M. |
OK, scottt, if you return later, let me know
|
Mark M. |
David: back to you -- do you have another question?
|
David B. |
The viewpager in my app has five pages. There's a
starting fragment within each page. During use, the user may drill
down through related fragments (think Master->Detail->Action)
within any given page. I would like (through state retention) for the
users position (current fragement) within each page to be retained as
he/she swipes between pages; I'm assuming I'll be using extending
FragmentStatePagerAdapter. I'm a bit worried about losing track of all
these fragments, and also that the back-stack will become spaghetti.
I'm looking for a good direction in implementing this.
|
Mark M. |
personally, I wouldn't do that in the first place
|
David B. |
Ok, I'm open.
|
Mark M. |
I am not a fan of replacing-the-tab-content as a form of navigation
|
Dec 27 | 8:00 PM |
Mark M. |
I was worried with your original description, but it wasn't what you were asking about, so I didn't say anything
|
Mark M. |
I agree with the concerns that you have outlined here in this question
|
David B. |
My app has four main functions (e.g. pages). Each function has multiple screens in depth.
|
Mark M. |
and therefore I do not know what the point of having the tabs/ViewPager is
|
Mark M. |
why are they pages?
|
David B. |
They aren't right now, but I was looking to make them pages.
|
Mark M. |
why aren't they just independent activities, the way you have them now (if I understand correctly)?
|
Mark M. |
why are you trying to make them be pages in a ViewPager?
|
David B. |
A couple of reasons. I've avoided the dashboard
metaphor and just have a small number of buttons on the home screen to
launch each activity. Now, I find myself adding additional major
functions and want the display to remain compact.
|
David B. |
The use of viewpager (or tabs) was intended to make additional functional areas directly accessible from the main activity.
|
Mark M. |
so, use action bar items, or possibly the "sliding
menu" stuff (tap on the upper-left icon, get navigation bar sliding out
from left)
|
David B. |
I intend to implement menu-drawer for secondary
functions. The app provides access to a university for student use,
there's a lot of functionality involved.
|
Dec 27 | 8:05 PM |
Mark M. |
then keep your pages in the ViewPager to top-level stuff, and when they 'drill down', launch a separate activity
|
Mark M. |
for example, in Contacts, tapping on a contact opens a separate activity
|
David B. |
Fair enough. Just to be clear, I should try to avoid swapping fragments within individual pages.
|
Mark M. |
that's my design recommendation
|
David B. |
Thanks. I'll take it! :-)
|
scottt |
sorry, i got dragged into an active conf call. i have a quick question: do you have a discount code for the boston adndevcon?
|
Mark M. |
I have my own take on what constitutes good mobile design
|
Mark M. |
scottt: I don't think they're set up yet
|
scottt |
ok
|
Mark M. |
mainly because the call for papers is still active and there's no conference agenda yet
|
Mark M. |
jwandroid33: do you have another question?
|
jwandroid33 |
Not today. POssibly tommorow :-)
|
Mark M. |
OK
|
Mark M. |
Peri: do you have another question?
|
jwandroid33 |
just lietening in
|
Peri H. |
This has to do with writing files to the external
storage. I'm using Environment.getExternalStorageDirectory(), which
appears to be working fine. The problem is that on my Windows machine,
I'm not seeing the file I create. It shows up in the eclipse file
explorer, among some other files. But my windows explorer doesn't show
it, though other subfolders in the same directory (from other apps) do
show up. Ever seen this?
|
Mark M. |
yes
|
Mark M. |
first, though, ideally, don't use getExternalStorageDirectory()
|
Peri H. |
What do you recommend?
|
Mark M. |
use something app-specific (getExternalFilesDir())
|
Mark M. |
or getExternalStoragePublicDirectory() for common locations for photos, movies, etc.
|
Peri H. |
I read that if you uninstall, it will delete stuff
|
Mark M. |
yes, getExternalFilesDir() gets cleaned up on uninstall
|
Dec 27 | 8:10 PM |
Peri H. |
I tried getExternalStoragePublicDirectory(), too. Don't remember the specific problem - might have been the same.
|
Dec 27 | 8:10 PM |
Mark M. |
if it is supposed to live beyond that, it needs to be a type of file the user wants to hang onto
|
Mark M. |
such as photos, movies, etc.
|
Peri H. |
It is: exported data from the db.
|
Mark M. |
but, anyway, back to your problem
|
Mark M. |
that probably should go in DOWNLOADS, which is kinda a dumping ground for random stuff
|
Mark M. |
in terms of your visibility issue, read: http://commonsware.com/blog/2011/08/31/mtp-exte...
|
Mark M. |
(also covered in the book, IIRC)
|
Peri H. |
It could. That's a good alternative.
|
Ataul M. | has entered the room |
Peri H. |
Ok, I'll have alook right now. I'll be here in eh background
|
Mark M. |
so, in addition to the MediaScannerConnection
stuff you'll read about in that post, some MTP clients cache data,
requiring you to unplug and re-plug in the device before the changes
show up
|
Mark M. |
nothing much we can do about that
|
Ataul M. |
Hi, have I caught the end of this hour?
|
Mark M. |
Atual: hi! we still have a few minutes left
|
Mark M. |
Atual: so, it's your turn -- do you have a question?
|
Ataul M. |
yes please :D
|
Ataul M. |
I'm using SimpleContentProvider, a lib for creating CPs for use with SQLite dbs
|
Ataul M. |
my issue is that in my DB I have several tables, and CPs seem to only return data from one
|
Mark M. |
CPs can return data from several tables
|
Ataul M. |
I saw loaderex
|
Mark M. |
whether SimpleContentProvider handles that, I can't say
|
Ataul M. |
were I override or add this (I don't think it does handle it, it's relatively new)
|
Mark M. |
though it looks like it does, based on the description
|
Ataul M. |
o rly :(
|
Mark M. |
it talks about foreign key relationships
|
Mark M. |
which implies multiple table support
|
Ataul M. |
I'll have another look then
|
Mark M. |
BTW I assume you are referring to https://github.com/mitmel/SimpleContentProvider
|
Ataul M. |
that's the one
|
Dec 27 | 8:15 PM |
Mark M. | |
Mark M. |
sounds like the sample code does not demonstrate it, but the tests do
|
Mark M. |
or something like that
|
Ataul M. |
I was also attempting to siphon away all the CRUD
operations to an abstract class, passing only Context from my activities
- would that be discouraged?
|
Mark M. |
so long as you are careful how long you hold onto the Context, to avoid memory leaks, that should be fine
|
Ataul M. |
sounds good, thanks! Will have another read of SCP (I was only looking at the example project), so thanks for the direction
|
Mark M. |
sure, no problem
|
Ataul M. |
have a good evening guys:)
|
Mark M. |
scottt: do you have another question?
|
Ataul M. | has left the room |
scottt |
not at the moment
|
Mark M. |
OK
|
Mark M. |
David: do you have another question?
|
David B. |
I'm good. Appreciate the help.
|
Mark M. |
Peri: do you have another question?
|
Peri H. |
So, you talk about using scanFile(). But I need a
MediaScannerConnection. Is that something I do independently of
writing the file?
|
Mark M. |
scanFile() is a static method on MediaScannerConnection, IIRC
|
scottt |
with the best level of early bird registration
ending next week (and needing to get the stuff booked this year), was
just looking for the code. i'll do some googling
|
Mark M. |
after you have written and closed the file, call scanFile()
|
Mark M. |
scottt: O
|
Peri H. |
Ok, that sounds pretty straightforward.
|
Mark M. |
scottt: I'll make an inquiry and will contact you if there's a code to use
|
scottt |
thx
|
Dec 27 | 8:20 PM |
Mark M. |
if anyone has a question, feel free to chime in
|
Peri H. |
Well, I've got a simple one. When an end user experiences a crash, what is sent to the developer console?
|
Mark M. |
that depends on whether or not they click the Report... button
|
Mark M. |
if they decline to send a report, I don't think you get anything
|
Peri H. |
Assuming they do.
|
Mark M. |
since I don't distribute apps on the Play Store, I can't say for certain
|
Mark M. |
I know it includes stack trace data
|
Peri H. |
Oh, how do you distribute?
|
Mark M. |
well, the book APK is on your Warescription page
|
Mark M. |
so I use ACRA to collect crash logs, etc.
|
Mark M. |
my impression is that the Developer Console does not give you as much as ACRA does
|
David B. |
I can confirm that. You'll only get the stack trace from the developer console.
|
Mark M. |
but that's just based on developer comments more than first-hand experience
|
Dec 27 | 8:25 PM |
Peri H. |
ok, cool. I'll look into ACRA.
|
Peri H. |
Thanks david, too
|
Mark M. |
David: do you get any device model or OS version data?
|
Mark M. |
that seems to be important, and that's
specifically what I thought the Console might not supply (for whatever
reason) based on what I was hearing
|
Peri H. |
Do you get the text from the exception itself?
|
David B. |
Hang on. I'll go look (not that my apps have ever crashed. :0
|
Mark M. |
Peri: that should be part of the stack trace, regardless of whether it is from the Console or ACRA
|
Peri H. |
I would think so, but just asking
|
Mark M. |
it's definitely in the ACRA stack trace
|
David B. |
No. Just the stack trace and the version of your app that was involved.
|
Mark M. |
#fail
|
David B. |
:-)
|
Peri H. |
Sucks. Ok, ACRA it will be.
|
Mark M. |
ACRA is free, though you'll have to choose a back-end or host your own
|
Mark M. |
Google is putting pressure on ACRA to stop stuffing all the data in a Drive spreadsheet
|
Peri H. |
Hey, well thanks so much for the help today. These were questions I had on SEx and no one answered over several days.
|
Mark M. |
Peri: this isn't a great time of year for developer support
|
Peri H. |
Well, I'm so suprised :)
|
scottt |
ha! my conf call just ended
|
Peri H. |
Have a nice evening.
|
Dec 27 | 8:30 PM |
Mark M. |
you too
|
Peri H. | has left the room |
jwandroid33 |
Mark jumping off. Thanks for the help!
|
Mark M. |
no problem!
|
David B. |
Thanks again. Good night.
|
Mark M. |
that's a wrap for today's chat
|
jwandroid33 | has left the room |
David B. | has left the room |
Mark M. |
next one is tomorrow, 10am Eastern
|
scottt |
i saw some interesting questions/answers that i need to go back and review
|
scottt |
thx. bye
|
Mark M. |
I'll be posting the transcript shortly
|
Mark M. |
check http://commonsware.com/office-hours/ in a few minutes
|
Mark M. |
have a pleasant evening!
|
scottt | has left the room |
Mark M. | turned off guest access |