Android universal build

Hey

What with the hundreds of different screen resolutions for android, instead of creating different apps I am attempting to build a single app that responds to the device screen size and moves things accordingly.

This is easy enough to do for iOS using an offset based on display size - I followed this tutorial:



It works perfectly, cropping the screen and moving actors to fit on iphone. Unfortunately the same rules don't seem to work when I test on android (using an ad hoc) - it just crops without moving the actors. This means that many of the actors in the croppable zone are not visible.

Is there any reasons why these rules aren't kicking in? Since the rules are based on screen size and moving actors on an offset I can't think of any reason why it wouldn't work.

Failing that, has anyone got any other solutions for building a responsive app on android? I know @deepblueapps showed tutorial a while ago that probably would work, but since it involves stretching actors, I'm not overly keen on using it

Comments

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    I haven't built a responsive one for Android yet but I was considering looking at positioning and (maybe) sizing of actors based on percentages when I start to properly build my second. I don't know how easy it'll be but I will give it a go.
  • imjustmikeimjustmike Member Posts: 450
    I'll keep my fingers crossed for you Kevin.

    Does anyone else have any experience with android publishing?
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited August 2013
    10.3 has a bug where it doesn't see the screen size on android devices. This is your problem. It's been fixed in the nightly builds.
  • zzap64zzap64 Member Posts: 405
    I always find letterbox a safe bet for Android. I use it for Kindle. Amazon approval never had an issue. 'Suppose down to individual app aesthetics and personal choice. Changing the background color can help alleviate the letterbox look too.
  • aanbariaanbari Member, PRO Posts: 15
    I tried the latest nightly build 00.88, and my android devices are now detecting screen sizes with Overscan adhoc builds. Here is how I did it:

    My app starts with an iPad Landscape platform. In my home screen:
    - I have an actor that calculates a ratio of the (game.screen.size.height/game.screen.size.width)

    - If the ratio is above 0.7 (iPad or iPad mini), I do nothing to the static actors.

    - If the ratio is <0.6 (like iPhone 5 or Samsung S4, Samsung 7" tab), I move the static actors down or up 88 pixels depending whether they are in the top half or bottom half of the screen.

    -If the ratio is between 0.6 and 0.7 (like iPhone 4S, Samsung 10" and 8" tab), I move the static actors down or up 52 pixels.

    This has worked so far for my iOS and android devices with adhoc builds using Overscan. However, with the android devices, I found that I needed to add a Reset Scene in the Home page for it to work. This calculation takes place in the first actor in the Background layer on the Home scene so I am not sure why it was not moving the actors like it does with my iOS devices. In order for this to work across all platforms (iOS and Android), it may be a good idea to make the first scene a blank page which has that actor which does the above calculation and sets the offset numbers into a global attribute, waits 0.2 seconds, then goes to the Home Screen of your game. This way, you won't see the static actors moving on the screen.


    Thanks so much for the awesome nightly builds!!

    -Ammar
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    You can do it simpler with a few aspect ratio based on screen size this way it always looks to the device screen size for all scenes. I do it using two less than screen height. Aspect ratios makes it simple as the screen height is always the defining ratio. Width is a non issue.
  • aanbariaanbari Member, PRO Posts: 15
    Thanks Dave @FryingBaconStudios. I learned everything I know about publishing GS to Android from you. I must have seen your videos a hundred plus times.

    I found a bug in the 0.88 Nightly Build GSViewer.apk for Mac. I noticed that the Viewer only reads the device's screen dimensions accurately the first time it is run. If I switch to another app and come back to the Viewer again to run my app, it reverts back to the original Platform dimensions (in my case iPad). This happened on both my Samsung S4 and Galaxy Tab 10". So I think it has to do with the .apk itself.

    Be sure to close the Viewer app completely before running it again.
  • BlackCloakGSBlackCloakGS Member, PRO Posts: 2,250
    edited August 2013
    @aanbari
    Hymloe reported this bug to me. I was hoping to get to it on friday but I was not able to. I will be looking into the bug on monday.
  • imjustmikeimjustmike Member Posts: 450
    @fryingbaconstudios and @aanbari - thanks for the heads up. I'll download the latest nightly build and build an ad hoc.

    @fryingbaconstudios - two less than screen height is quite a clever idea, requires less maths than creating an offset if the actors are always close to the edge. I'll have to use that on a hud I'm using on my next game.

    @blackcloakGS - thanks for reply - do you have a rough idea of when a bug fix will be in a stable release?
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    I'm going to do a video on that technique here when I get a chance swamped with client work right now but maybe this week.
  • william24william24 Member, PRO Posts: 143
    @FryingBaconStudios Have you created the video on that technique yet? Just curious.
Sign In or Register to comment.