Sean
Sean

Reputation: 155

how to go full-screen on android with no status bar and renderMode set to direct?

I'm building an AIR->android app for a retail kiosk. We are going to hide the 'status bar' so the app is full-screen and doesn't have the soft button bar (it will also be locked into kiosk mode using a 3rd party app).

When I publish and run my app on our device with the status bar hidden the flash stage colour is visible where the original status bar was. This space should be filled with the app contents (full-screen images etc) but the 68px space which originally contained the bar is just solid white (or whatever backgroundColor the stage is set to)

After a lot of trial and error I've nailed this down to the fact that I have renderMode set to direct in the app descriptor xml. If I remove this the app contents fill the screen, but obviously I don't have access to the GPU accelerated rendering system.

I'm assuming this is something to do with AIR asking the device's hardware of it's resolution, which it returns as 1920x1032 even though the actual number of pixels is 1920x1080. So under the hood AIR is only setting up a renderable window of 1920x1032 (when in renderMode>direct).

Does anyone know of a way of enabling true full-screen when in renderMode>direct ?

Upvotes: 0

Views: 1826

Answers (1)

BotMaster
BotMaster

Reputation: 2223

An Android MEtrics ANE is one of the simplest to put together. Here's a sample of mine for getting the x resolution. If you have no experience doing ANEs that might be the right one for a start:

@Override
public FREObject call(FREContext arg0, FREObject[] arg1)
{
    try
    {
        DisplayMetrics metrics = arg0.getActivity().getResources().getDisplayMetrics();
        int realWidth = metrics.widthPixels;
        try
        {
            Display display = arg0.getActivity().getWindowManager().getDefaultDisplay();
            display.getRealMetrics(metrics);
            int rawWidth = metrics.widthPixels;
            if(rawWidth > realWidth)
            {
                realWidth = rawWidth;
            }
        }
        catch(Exception e)
        {

        }
        try
        {
            Display display = arg0.getActivity().getWindowManager().getDefaultDisplay();
            int rawWidth = 0;
            Method getRawWidth = Display.class.getMethod("getRawWidth");
            rawWidth = (Integer) getRawWidth.invoke(display);               
            if(rawWidth > realWidth)
            {
                realWidth = rawWidth;
            }
        }
        catch(Exception e)
        {

        }           
        FREObject baseValue = FREObject.newObject(realWidth);
        return baseValue;
    }
    catch(Exception e)
    {

    }
    return null;
}

Upvotes: 0

Related Questions