GLBasic forum

Main forum => GLBasic - en => Topic started by: Gary on 2011-Aug-25

Title: Android screen size
Post by: Gary on 2011-Aug-25
Is there any commands that will give the screen size of an android device? I am thinking that I can read the screen size then set the screen up to full screen and use the available size so that apps look nice on every device with the single app
Title: Re: Android screen size
Post by: Kitty Hello on 2011-Aug-25
GETSCREENSIZE and GETDESKTOPSIZE should do.
Title: Re: Android screen size
Post by: spacefractal on 2011-Aug-25
its not that easy, there might require some changes to the AndroidManifest.xml file:

this line: android:anyDensity="false" /> should been android:anyDensity="true" />

As least here, elsewise the game would just been upscaled from a lowresoulution (what it happens here).

Also Acer have a 21:9 tablet, which require a another line (if you plan to native support those, elsewise it might been cropped on each side):
<uses-feature android:name="com.acer.android.XLONG_SCREEN" android:required="false" />

here is full xml file I use:
Code (glbasic) Select

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.headsoft.greedymouse"
     android:installLocation="preferExternal"
     android:versionCode="1"
     android:versionName="1.0">
    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.BATTERY_STATS" />
<uses-feature android:name="com.acer.android.XLONG_SCREEN" android:required="false" />
<supports-screens android:resizeable="false"
  android:smallScreens="true"
  android:normalScreens="true"
  android:largeScreens="true"
  android:anyDensity="true" />
    <application android:label="@string/app_name" android:icon="@drawable/icon" android:debuggable="false">
        <activity android:name="org.libsdl.app.SDLActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>


PS.  android:installLocation="preferExternal" is really important, since many Android phones actuelly does NOT have very much internal memory.... Some applications required to installed on internal memory, but I dont think a game should.
Title: Re: Android screen size
Post by: ampos on 2011-Aug-26
Where can we get the full list for Manifest.xml?