0

Is it possible to submit a different version of an app (different .apk) to google play for the tablet version of an app like with apple?

Otherwise how can I differentiate between a phone device with a resolution of 1280 x 720 (galaxy s3) and a tablet with the same resolution? As I would want to load different layouts depending on whether the app is running on a tablet or a phone.

Thanks

Lukesmith
  • 170
  • 2
  • 16

2 Answers2

2

That is what the layout folders are for. There are the density attributes such as ldpi, mdpi, hdpi, xhdpi for low, medium, high, and extra high density screen resolutions.

There are also small, normal, large, xlarge for the screen sizes.

You could have the folders such as res/layout-normal-hdpi and res/layout-large-hdpi and many others with all of the various xml layouts in each folder and Android will pull the layout from the most appropriate folder to display.

See also: http://developer.android.com/guide/practices/screens_support.html

TronicZomB
  • 8,667
  • 7
  • 35
  • 50
  • Ah I see, the problem is that I'm using the Marmalade SDK so I don't have these folders. – Lukesmith Jun 19 '13 at 18:42
  • @Lukesmith I'm not familiar with the Marmalade SDK, could you explain the folder structure of an Android app in it, just edit it into your question? Thanks. – TronicZomB Jun 19 '13 at 18:45
  • Well with Marmalade SDK I work in C++ and then it works its magic and somehow creates and APK. The purpose of this is that you can build once and deploy to multiple platforms. – Lukesmith Jun 19 '13 at 18:55
  • Is there any way I can submit a separate app to the app store for tablets like with apple? – Lukesmith Jun 19 '13 at 19:00
  • Don't know. This might be of interest to you: http://www.madewithmarmalade.com/devnet/forum/definitive-guide-android-external-res-mkb-option-please – TronicZomB Jun 19 '13 at 19:00
  • I'm not sure theres much I can do with that. It seems like theres no way to differentiate unless I specifically test for devices by their name / model no. I guess this is feasible as there are fairly few devices with very large resolutions. – Lukesmith Jun 19 '13 at 19:41
  • You might be able to use an if statement to display the proper layout. That might be the way that you have to go. – TronicZomB Jun 19 '13 at 19:50
  • Yeah but what should I test in the if statement? Or do you mean to test specific phone models etc like I said? – Lukesmith Jun 19 '13 at 21:09
  • I THINK there is a way to pull the screen size/density and you could compare that. – TronicZomB Jun 20 '13 at 12:32
  • Thanks man, I found a Marmalade dpi extension and it apparently has Android compatibility (https://github.com/marmalade/dpi). No idea how they are doing it but seems like it could be the answer. Any ideas what kind of number for screen dpi I should test to determine if its a phone or tablet? – Lukesmith Jun 20 '13 at 13:45
  • Phones and tablets can have the same dpi with different screen sizes. – TronicZomB Jun 20 '13 at 13:48
  • 1
    Yes true, actually I can derive the screen size in inches from the dpi and resolution so I guess it makes the most sense to then base the comparison by the screen inches and load the appropriate UI. That calculation is explained here (http://stackoverflow.com/questions/6589101/how-to-get-screen-size-of-device). Thanks very much for your help. – Lukesmith Jun 20 '13 at 14:31
0

I believe the best solution to this is to use this extension for Marmalade to get the dpi of the device the app is running on (github.com/marmalade/dpi) and then derive the diagonal size of the screen in inches with the following formula:

DiagonalInches = SQRT( ((screenWidth / dpi)^2) + ((screenHeight / dpi)^2) )

in code:

double x = Math.pow(screenWidthPixels / dpi, 2);
double y = Math.pow(screenHeightPixels / dpi, 2);

double screenInches = Math.sqrt(x+y);

Then simply decide a minimum screen size (in inches / cm) to use the tablet UI

Lukesmith
  • 170
  • 2
  • 16