Wednesday, March 2, 2011

[android-developers] Re: One app, multiple APKs targeting different SDK levels would be good for adding Honeycomb functionality

having one apk to rule them all is a tricky thing to manage. i just
recently launched with normal, large, and xlarge layouts along with
landscape for large and xlarge. it is not easy, it takes a ton of
regression testing, but is totally worth it.

there are some people that are developing seperate apps for tablet. i
wouldn't recommend it, personally. maybe if you pull out all business
logic and throw it in a library it may be easier but there would be a
ton of redundant work. abstract out the work of building out the
views, and that will allow you to manage each resolution re-using the
same techniques.


one tip is to have a very easily accessible flag that allows you to
differentiate which device you're running on.

//check to see if we have a tablet, large or phone, and then set the
global flag
int screenLayout = getResources().getConfiguration().screenLayout;
model.isTablet = ((screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK) ==
Configuration.SCREENLAYOUT_SIZE_XLARGE);

//if isTablet is false, check to see if we have a Large device, else
we have a phone
if(model.isTablet == false){
model.isLarge = ((screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK) ==
Configuration.SCREENLAYOUT_SIZE_LARGE);
if(model.isLarge){
model.deviceSize = "Large";
}else{
model.deviceSize = "Phone";
}
}else{
model.deviceSize = "Tablet";
model.isLarge = false;
}

throw in a isLandscape if that matters as well.

public boolean isLandscape(Context context) {
int orientation =
context.getResources().getConfiguration().orientation;
return (orientation == Configuration.ORIENTATION_LANDSCAPE);
}

by using these flags on simple singleton model, you can easily build
out the appropriate view for any scenario....except for small. just
add a new flag for that ;)

-rob

On Mar 2, 11:51 pm, Mark Carter <mjc1...@googlemail.com> wrote:
> One of the main reasons I have not started any Honeycomb-specific
> development is because of the extra complexity it would bring to my existing
> codebase.
>
> If it were possible to upload multiple APKs (targeting different SDK level
> ranges) for the same app, I would be much more likely to take advantage of
> features of the latest SDK releases.
>
> I know it's possible to do all this using various approaches like reflection
> but I don't want to risk introducing bugs to those running on older levels.
> Also why should "old" users receive all the updates that are just fixing
> Honeycomb-issues?
>
> If I could develop a Honeycomb (and later) APK (and upload that alongside
> the existing APK) then that would solve these problems.
>
> BTW, for me, having a completely separate app for Honeycomb, is not an
> option.
>
> Is this something that has been discussed much before? Is it ever likely to
> happen?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment