Android Question Compatibility with tablets in Play Store

PacoViv

Member
Licensed User
I uploaded my first app to play store.
Everything was ok but in "Optimization tips" google said that:
Your APK must include customizable design resources for common tablet screen densities.
And also that I should upload capture screen for tablets.

So I did those captures and also I changed the icon launcher (the only icon I have) following the info of PhilipBrown here
https://www.b4x.com/android/forum/threads/implementing-launcher-icons-using-mipmap.51550/
where i'ts perfectly explained.

putting different size ic_launcher.png in the mipmap folders.
I also changed the manifest editor as PhilipBrown says.
SetApplicationAttribute(android:icon, "@mipmap/ic_launcher")

And everything works ok, I see a smaller icon than before on the phone, and big on the tablet.

After upload the new version, play store now doesn't mention the tablet captures (so it's ok) but it continues saying that:
Your APK must include customizable design resources for common tablet screen densities.
with this link https://developer.android.com/distribute/essentials/quality/tablets.html#use-tablet-icons

The question is, what more must I do?

My app has a single activity and several layouts as panels (with autoescale all and percents) and all look ok in the UI Cloud, also in the phone and 7 inch tablet I have.

I have another question but the main is the previous.
I have only one icon (the app icon) but I tried to add another one and put the different versions in the correspondent drawable- hdpi etc. folders but it does not work, the new icon replaces the app icon.
So the second question is how to get an icon or any image be shown according the device like in the launcher icon, and what must I add to the manifest?.
It would be ideal an example like the one of the icon launcher by PhilipBrown.

Thank you.
 

PacoViv

Member
Licensed User
Thanks, it's what I would like, to ignore the google guidelines.
Maybe in a future I'll can, when I'm a famous programmer :)
But so far...
I see how my app rank so low in play store...

Anyways, I would like to understand at least how to use different images in an app, put them in different resolutions in drawable folders (or wherever) and to know how to set up this in the manifest editor.
For example, if I want to make an app using many images I need (not only for the google guidelines) those images in mdpi, hdpi, xhdpi, xxhdpi etc. and that Android choose the appropiate ones for each device.

Maybe this way google also would aprove the app as designed for tablets.
But independently of google is something that I'd need.
I was searching for a week on this forum and in all internet and didn't find a clear explanation yet. Even few questions about, may it be so obvious and I can't see it?.
For instance I saw the android assets studio https://jgilfelt.github.io/AndroidAssetStudio/index.html
And seems very nice, but I couldn't see any example in b4A code and manifest on how exactly implement this.

Thanks
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
You have entered in the Store Card, "GRAPHIC RESOURCES" Images for Tablet and Manifest you indicated that this app is also suitable for large display. The automatic system did not find the layout for the Tablet.

In the future add to design a layout with different resolutions small, medium and large and you will not signal errors
Or do not insert graphics resources for TABLET and Manifest disability (False) the big screens.
Third option, ignore the message, as stated above
 
Upvote 0

PacoViv

Member
Licensed User
Thanks, so do you mean to have 3 different layouts for each one I have now and charge one or another in code based in something like this?
If GetDevicePhysicalSize > 6 Then
'7'' or 10'' tablet
Else
'phone
End If

I could use just two layouts, like in the example (couldn't I?)
and
The layouts for tablets in landscape? or it does not matter?

And of course the layouts for tablets must have views with the same name as in the regular layout?

I guess I can save the layouts in the designer with save as... and then edit them for tablet, for example save as Layout1tablet

Thanks
 
Last edited:
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Not exactly.
When I say I am referring to the Design Layout you find in the menu that allows you to create layouts in XML.
I believe that the system does not go rummaging in the code but in XML.

What I guess you have not even used. (To understand Activity.LoadLayout ( "Main"))

Now is 4.
Small, medium, large, very large.
Google yesterday sent an email to specify this. I think someone has are opening a thread on this,
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
The layout in the tablet is important in case you want a different design in the tablet because you have more space to use.

Usually in smatphone (especially small ones) have all collapsed because space is limited. We must strive to let all the buttons and be manageable.

In the tablet, you can study one of the buttons available and wider and friendly menu.
 
Upvote 0

PacoViv

Member
Licensed User
Thank you very much.

You say:
When I say I am referring to the Design Layout you find in the menu that allows you to create layouts in XML.
I believe that the system does not go rummaging in the code but in XML.
What I guess you have not even used. (To understand Activity.LoadLayout ( "Main"))


But I can't see any option in the designer about to create layouts in XML.

I'm using b4a 5.02 (1) maybe it appairs in the version 6.
I'm delaying the update based in the programmers max "if it works do not fix it" :)
But I think it will be the best.
Now.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
24zkjg6.png
 
Last edited:
Upvote 0

PacoViv

Member
Licensed User
Thank you again.

Fortunately I knew where to find the designer, my meaning was that in the designer itself I can't see anything related with XML.
designer.jpg
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Here you can draw objects position them and add code to resize them or position them according to your needs

You can choose the size of the display 'orientation, etc.
I think there is a guide on youtube In Italian there I suppose in English
 
Upvote 0

PacoViv

Member
Licensed User
Grazie, I know something about use the designer.

My meaning was:
Something like this in the code:

If GetDevicePhysicalSize > 6 Then
'7'' or 10'' tablet
Else
'phone
End If

Ok, for 3 or 4 screen sizes.

And in the designer: instead of to have one layout for each screen of the program, to have 3 or 4 layouts for every one.

I think this is correct. Hope google realizes this is for tablets too.

I've just updated to the latest b4a enterprise version. I'll see the new things in it.

Thanks
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
There are ways to detect the screen size live code. In the forum you will find many examples

however, Google's automatic system, I think it only checks the manifest.
 
Upvote 0

PacoViv

Member
Licensed User
it only checks the manifest

And what google must find in it?

Because this seems not to be enough:

<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)

neither this
SetApplicationAttribute(android:icon, "@mipmap/ic_launcher")

having the different ic_launcher in the correspondant folder for each dpi, it works perfectly but google continue saying is not for tablets
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Check the Manifest and compares it with the layout you entered in your APK

With this Manifest are you saying that your app is suitable for any type of screen so Google expects you've added XML layout for at least three screen sizes specified in manfest Small normal and Others

The message should disappear when you create layouts for the three formats:

23rlqxl.png


After create a layout

2pt2n88.png




Until we create different layouts for various display alerts you mistake.

In any case accept the suggestions given at the beginning.

IGNORE THE ERROR MESSAGE
 
Last edited:
Upvote 0

PacoViv

Member
Licensed User
Thank you very much!

I never used the Variants tab in the designer, tried now and it's very easy.
I don't have to create new layouts, just variants and readjust the views to fit in each variant. Perfect!

and thanks for the self-explainatory screenshot.
 
Upvote 0

stanmiller

Active Member
Licensed User
Longtime User
Thank you very much!

I never used the Variants tab in the designer, tried now and it's very easy.
I don't have to create new layouts, just variants and readjust the views to fit in each variant. Perfect!

and thanks for the self-explainatory screenshot.

At times it's valuable to know at runtime which variant B4A selected for the device. You can do this by placing a hidden label on your layout and in each script variant assign a value corresponding to the target device.

This example is from B4I but the same applies to B4A.

1_label_varient_iphone4_zpss8bppfhw.jpg
 
Upvote 0

PacoViv

Member
Licensed User
Thank you for the info.

I ignored also the Script Variant tab, thank you. So far (after the info of Star-Dust) I added the 4 variants for every layout I had and as I have all the views in percent and autoescale all I didn't have to change anything in the designer of any variant, right now I see that in the variant tabs I have just this:
'Variant specific script: 800x1280,scale=1 or this:
'Variant specific script: 320x480,scale=1 commented.

But I don't know if I understood you completely. Ok, I put in every script variant a line with lblvariant.text ="iphone4" ... lblvariant.text ="tablet10" etc.

But if the label is visible =False I can't see it in runtime.
 
Upvote 0

stanmiller

Active Member
Licensed User
Longtime User
Thank you for the info.

I ignored also the Script Variant tab, thank you. So far (after the info of Star-Dust) I added the 4 variants for every layout I had and as I have all the views in percent and autoescale all I didn't have to change anything in the designer of any variant, right now I see that in the variant tabs I have just this:
'Variant specific script: 800x1280,scale=1 or this:
'Variant specific script: 320x480,scale=1 commented.

But I don't know if I understood you completely. Ok, I put in every script variant a line with lblvariant.text ="iphone4" ... lblvariant.text ="tablet10" etc.

But if the label is visible =False I can't see it in runtime.

You want the view lblVariant to be invisible to the user. It's a hidden tool for debugging or to make additional adjustments after the layout is loaded.

With lblVariant you won't need to interpret GetPhysicalDeviceSize. You'll know exactly which variant B4A selected based on scaling and screen dimensions.

Declare lblVariant as any other view on the layout and use as applicable.
B4X:
Sub Globals

...

Dim lblVariant As Label

...
End Sub

Sub Activity_Create(FirstTime As Boolean)

   ' Load main layout
   Activity.LoadLayout("main")

   ' Report layout selected to log
   Log( "B4A selected layout=" & lblVariant.Text )

   ...

   Select (  lblVariant.Text.ToLowerCase )
   Case "normal"
       ...
   Case "tablet7"
       ...
   Case "tablet10"
       ...
   Case Else
        Log( "Unrecognized variant.  lblVariant.Text=" & lblVariant.Text
    End Select

End Sub

Even if there are no adjustments made in the variant script tab, it's still valuable to add a single line and assign lblVariant.Text a target name.

We report the layout selected on our About page as L1, L2, L3, etc... These correspond to the different variants and the Lx naming masks the actual target names. If a customer reports that a screen is not displaying correctly we can see the name of their device and what layout was selected. Sometimes we get surprised :).

siteone_about_layout_zpsl6bltxrj.jpg
 
Last edited:
Upvote 0

PacoViv

Member
Licensed User
Yes, of course, sorry for the silly question, what I was thinking was to put the label visible while debug for me can see it in the device thru b4a bridge and make it invisible when compiling for upload. That was the reason for my comment.

But I can see it this way too thru the log and don't have to remember to change it to invisible later.

Thanks again for the valuable info you gave me.

And very interesting the About page, I'll use that too.
 
Last edited:
Upvote 0
Top