Software Archive
Read-only legacy content
17061 Discussions

Missed full screen

Campuzano_Serna__Jua
940 Views

Hello, I created a game with C2 for Android using the XDK version 3641.
I use crosswalk.
I have marked "fullscreen".
CLI 5.4.1
Plugins:
Statusbar cordova
Device cordova

All perfect, the performance is excellent but something happens.
I run my game on my Galaxy S6 smartphone (android 6) and my game looks full screen, but if I click the button on the tasks that are open and I press "close all".
When I run again my game now no longer looks full screen like before.

In this gif you can see how it looks at the beginning and after closing all the applications and re-run the game.
It can be seen that there have now appeared margins up / down and to the sides, there is no full screen.

http://imgur.com/a/P4Xrq

My game uses 400x240 resolution.

This seems not to happen on android 4.2
Why does this happen?.

Please, if you need any information, I will be happy to provide it.
Sorry for my English.
Greetings.

0 Kudos
18 Replies
Giselle_G_Intel
Employee
940 Views

Once you close your app and restart, does it ever return to full screen? As in, does it go back to full screen when you close it and restart again or do the margins stay forever after that initial run and restart?

0 Kudos
Campuzano_Serna__Jua
940 Views

Giselle G. (Intel) wrote:

Once you close your app and restart, does it ever return to full screen? As in, does it go back to full screen when you close it and restart again or do the margins stay forever after that initial run and restart?

Hello, restarting the game does not work.
To be able to get full screen again I must reinstall and try to get it like this, sometimes it is not achieved and it is necessary to retry the installation.

0 Kudos
PaulF_IntelCorp
Employee
940 Views
  • Are you building with Crosswalk? If so, which version? Have you tried other versions?
  • Have you tried building with CLI 6.2.0? If so, does it work any differently?
  • Have you tried adding <preference name="Fullscreen" value="true" /> to the intelxdk.config.additions.xml file?
  • If all else fails, you may have to use this plugin > https://github.com/mesmotronic/cordova-plugin-fullscreen < which requires adding code to your game.
0 Kudos
Campuzano_Serna__Jua
940 Views

Paul F. (Intel) wrote:

  • Are you building with Crosswalk? If so, which version? Have you tried other versions?
  • Have you tried building with CLI 6.2.0? If so, does it work any differently?
  • Have you tried adding <preference name="Fullscreen" value="true" /> to the intelxdk.config.additions.xml file?
  • If all else fails, you may have to use this plugin > https://github.com/mesmotronic/cordova-plugin-fullscreen < which requires adding code to your game.

Hello, that plugin had already tried it but I do not know what code I should add to the game.

I later discovered this plugin
Https://www.npmjs.com/package/cordova-fs-plugin-fullscreen
I added the code
Fullscreen.on ();
But it did not work for me with CLI 5.4.1
-------------------------
Have you tried adding to the intelxdk.config.additions.xml file? <Preference name = "Fullscreen" value = "true" />

This did not work for me.
---------------------------
Have you tried building with CLI 6.2.0? If so, does it work any differently?
+
Have you tried adding to the intelxdk.config.additions.xml file? <Preference name = "Fullscreen" value = "true" />

This did not work for me, there was no difference that I noticed.
---------------------------
With crosswalk 18
+
CLI 6.2.0
+
Add <preference name = "Fullscreen" value = "true" /> to the intelxdk.config.additions.xml file

No full screen on first install
I did not try any more facilities.
--------------------------
With crosswalk 18
+
CLI 6.2.0
+
Add <preference name = "Fullscreen" value = "true" /> to the intelxdk.config.additions.xml file
+
Plugin https://www.npmjs.com/package/cordova-fs-plugin-fullscreen
And code added: "Fullscreen.on ();"

First installation with full screen, then I did "close everything" and the full screen disappeared as in all previous tests.
-----------------------------
With crosswalk 17
+
CLI 6.2.0
+
Add <preference name = "Fullscreen" value = "true" /> to the intelxdk.config.additions.xml file
+
Plugin https://www.npmjs.com/package/cordova-fs-plugin-fullscreen
And code added: "Fullscreen.on ();"

I did not get results, the screen is always lost when I close everything and restart my game

-----------------------------

I always got the same results
1 - I install and execute the game and most of the occasions I have full screen
2 - pulse in "close all"
3 - I re-run the game and the full screen disappeared

I only have to try that plugin you told me but I do not know the code that I should add to my game.

0 Kudos
PaulF_IntelCorp
Employee
940 Views

To use the plugin you identified (cordova-fs-plugin-fullscreen) you can add the following to your index.html file:

<script>
document.addEventListener('deviceready', function () {
    if( typeof Fullscreen !== 'undefined' ) {
        Fullscreen.on() ;
    }
}) ;
</script>

Safest bet would be to put it at the end of the index.html file, just before the </body> tag. If your index.html file is being auto-generated by some game editor or other tool you'll have to add that back each time you regenerate your app files. Obviously, you'll need to also include the plugin as part of the project, otherwise the above will not do anything when the app runs. Since this is a third-party app, you'll only see the effect on a built app that is installed on a device, will not see it do anything in the Simulate tab or in App Preview.

0 Kudos
Campuzano_Serna__Jua
940 Views

Hello, the code finally looks like this:

plugin added: http://imgur.com/a/caSbb

=====================

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <title>NSRTests2</title>
    
    <!-- Allow fullscreen mode on iOS devices. (These are Apple specific meta tags.) -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <link rel="apple-touch-icon" sizes="256x256" href="icon-256.png" />
    <meta name="HandheldFriendly" content="true" />
    
    <!-- Chrome for Android web app tags -->
    <meta name="mobile-web-app-capable" content="yes" />
    <link rel="shortcut icon" sizes="256x256" href="icon-256.png" />

    <!-- All margins and padding must be zero for the canvas to fill the screen. -->
    <style type="text/css">
        * {
            padding: 0;
            margin: 0;
        }
        html, body {
            background: #000;
            color: #fff;
            overflow: hidden;
            touch-action: none;
            -ms-touch-action: none;
        }
        canvas {
            touch-action-delay: none;
            touch-action: none;
            -ms-touch-action: none;
        }
    </style>
    

</head> 
 
<body> 
    <div id="fb-root"></div>
    
    <div id="c2canvasdiv">
        <!-- The canvas the project will render to.  If you change its ID, don't forget to change the
        ID the runtime looks for in the jQuery events above (ready() and cr_sizeCanvas()). -->
        <canvas id="c2canvas" width="400" height="240">
            <!-- This text is displayed if the visitor's browser does not support HTML5.
            You can change it, but it is a good idea to link to a description of a browser
            and provide some links to download some popular HTML5-compatible browsers. -->
            <h1>Your browser does not appear to support HTML5.  Try upgrading your browser to the latest version.  <a href="http://www.whatbrowser.org">What is a browser?</a>
            <br/><br/><a href="http://www.microsoft.com/windows/internet-explorer/default.aspx">Microsoft Internet Explorer</a><br/>
            <a href="http://www.mozilla.com/firefox/">Mozilla Firefox</a><br/>
            <a href="http://www.google.com/chrome/">Google Chrome</a><br/>
            <a href="http://www.apple.com/safari/download/">Apple Safari</a></h1>
        </canvas>
    </div>
    
    <!-- Construct 2 exported games require jQuery. -->
    <script src="jquery-2.1.1.min.js"></script>

 

    <script src="cordova.js"></script>
    
    <!-- The runtime script.  You can rename it, but don't forget to rename the reference here as well.
    This file will have been minified and obfuscated if you enabled "Minify script" during export. -->
    <script src="c2runtime.js"></script>

    <script>
        document.addEventListener("deviceready", function ()
        {
            window["c2iscordova"] = true;
            
            // Create new runtime using the c2canvas
            cr_createRuntime("c2canvas");
            
            document.addEventListener("pause", function() {
                cr_setSuspended(true);
            }, false);
            
            document.addEventListener("resume", function() {
                cr_setSuspended(false);
            }, false);
            
        }, false);
    
    </script>

    <script>
document.addEventListener('deviceready', function () {
    if( typeof Fullscreen !== 'undefined' ) {
        Fullscreen.on() ;
    }
}) ;
    </script>

</body> 
</html>

===========================

I think it is well done.
With that code I did some more tests.
I think it is important that this error also happens if I do not use crosswalk.


CLI 6
cross 19
codigo en index html

--------------

cli 5.4.1 and Plugins downgraded to recommended versions in xdk
cross 19
code in index.html

------------------------

without crosswalk
code in index html

-----------------------

If I can provide any information or file to help solve this problem I will be happy to do so.

I forgot to say that I do not use emulators, all the tests I do in my galaxy 6s with android 6. 

In these last three days I have done over 100 tests. I do not know what else I could try.

Thank you!.

0 Kudos
Giselle_G_Intel
Employee
940 Views

For the code that Paul suggested, I would actually put that within your already defined deviceready code - within your deviceready listener, as you are defining that listener twice. Also, what do your errors look like with this new modified code - any new errors that were not popping up before?

0 Kudos
Campuzano_Serna__Jua
940 Views

Giselle G. (Intel) wrote:

For the code that Paul suggested, I would actually put that within your already defined deviceready code - within your deviceready listener, as you are defining that listener twice. Also, what do your errors look like with this new modified code - any new errors that were not popping up before?

I do not know if I understood you correctly. (I speak spanish)
You say the code I put is not in the right place ?.
That code had no effect on my tests.

Is that correct?

 <script>
        document.addEventListener("deviceready", function ()
        {

           if( typeof Fullscreen !== 'undefined' ) {
                 Fullscreen.on() ;
            }

            window["c2iscordova"] = true;
            
            // Create new runtime using the c2canvas
            cr_createRuntime("c2canvas");
            
            document.addEventListener("pause", function() {
                cr_setSuspended(true);
            }, false);
            
            document.addEventListener("resume", function() {
                cr_setSuspended(false);
            }, false);
            
        }, false);
    
    </script>

-----------------------

I have also tried that way with different versions of crosswalk and webview but I have not achieved anything.

0 Kudos
Giselle_G_Intel
Employee
940 Views

Correct, that is what I was suggesting, as you had two definitions of deviceready listener. What does debugging show as errors with this code?

0 Kudos
Campuzano_Serna__Jua
940 Views

Giselle G. (Intel) wrote:

Correct, that is what I was suggesting, as you had two definitions of deviceready listener. What does debugging show as errors with this code?

Should I use weinre to get that debug log ?.
If so, then I must document myself about its use because I have not used it yet.

0 Kudos
Giselle_G_Intel
Employee
940 Views
0 Kudos
Campuzano_Serna__Jua
940 Views

Giselle G. (Intel) wrote:

Check out these three different articles that talk about debugging now that the integrated debugger is deprecated:

How to install all this that will take me some time I have tried something else, I added this in config.xml
<Android: theme = "@ android: style / Theme.NoTitleBar.Fullscreen">

I would swear I also added it to intelxdk.config.android but it looks like it has been automatically deleted when I created the apk to do the test, I'm not sure.

The fact is that so far the error does not seem to occur, it may happen later but normally the error would have already occurred.
Can this have fixed something ?, I mean add the line <android: theme = "@ android: style / Theme.NoTitleBar.Fullscreen">.

Edit: Ok the error remains, when I have the log I will publish it.
0 Kudos
Campuzano_Serna__Jua
940 Views

Hello! I am happy to bring this record.
See if this can help solve this problem.

In this test I have the fullscreen plugin and its code added.
I also have:
<Preference name = "fullscreen" value = "true" />
In intelxdk.config.addition.xml and in config.xml

==================================

01-03 14:00:03.509  3488  4397 E Sensors : Pressure old sensor_state 16416, new
sensor_state : 16384 en : 0
01-03 14:00:06.609  3488  3488 E MotionRecognitionService: support TA ~
01-03 14:00:10.769  4342  4433 E ContactsProvider_EventLog: Flush buffer to file
 cnt : 10 size : 7Kb duration : 124ms lastUpdatedAfter : 60157 ms mFlush_time_th
reasold : 2000 mCurrentSize : 3620
01-03 14:00:14.789 19184 19184 E Zygote  : v2
01-03 14:00:14.789 19184 19184 E Zygote  : accessInfo : 0
01-03 14:00:14.859  8520  8520 E SamsungIME:          isHWKeyboardConnected() =
false --> false
01-03 14:00:15.049 19184 19184 E SRIB_DSS_ThreadedRenderer: initialize, mIsDcsEn
abledApp=true , with format= -1 scaleFactor=0.75
01-03 14:00:15.049 19184 19184 E libEGL  : SRIB_DSS: EGL_DSS_setDssApp factor=0.
750000
01-03 14:00:15.119  3488  3581 E WindowManager: Performed 6 layouts in a row. Sk
ipping
01-03 14:00:15.149 19184 19184 E ApkAssets: Error while loading asset assets/icu
dtl.dat: java.io.FileNotFoundException: assets/icudtl.dat
01-03 14:00:15.179 19184 19184 E chromium: [ERROR:xwalk_platform_notification_se
rvice.cc(142)] Not implemented reached in virtual bool xwalk::XWalkPlatformNotif
icationService::GetDisplayedPersistentNotifications(content::BrowserContext*, st
d::__1::set<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::
allocator<char> > >*)
01-03 14:00:15.179 19184 19184 E chromium: [ERROR:xwalk_browser_context.cc(80)]
Failed to read preference, error num: 0
01-03 14:00:15.329 19184 19248 E libEGL  : validate_display:255 error 3008 (EGL_
BAD_DISPLAY)
01-03 14:00:15.359 19184 19184 E chromium: [ERROR:layer_tree_host_impl.cc(2263)]
 Forcing zero-copy tile initialization as worker context is missing
01-03 14:00:16.029  3488  4356 E SensorService: getSensorList a sensor (HRM Ambi
ent Light Canceling) without holding its required permission: com.samsung.permis
sion.HRM_EXT
01-03 14:00:16.029  3488  4356 E SensorService: getSensorList a sensor (HRM Prox
imity detecting) without holding its required permission: com.samsung.permission
.HRM_EXT
01-03 14:00:16.029  3488  4356 E SensorService: getSensorList a sensor (HRMLED I
R) without holding its required permission: android.permission.BODY_SENSORS
01-03 14:00:16.029  3488  4356 E SensorService: getSensorList a sensor (HRMLED R
ED) without holding its required permission: android.permission.BODY_SENSORS
01-03 14:00:16.029  3488  4356 E SensorService: getSensorList a sensor (MAX86900
) without holding its required permission: com.samsung.permission.SSENSOR
01-03 14:00:16.029  3488  4356 E SensorService: getSensorList a sensor (HRM Sens
or) without holding its required permission: com.samsung.permission.SSENSOR
01-03 14:00:16.029  3488  4356 E SensorService: getSensorList a sensor (HeartRat
e Sensor) without holding its required permission: android.permission.BODY_SENSO
RS
01-03 14:00:16.629  3488  3488 E MotionRecognitionService: support TA ~
01-03 14:00:21.169 19265 19265 E Zygote  : v2
01-03 14:00:21.169 19265 19265 E Zygote  : accessInfo : 0
01-03 14:00:21.639 19294 19294 E Zygote  : v2
01-03 14:00:21.639 19294 19294 E Zygote  : accessInfo : 0
01-03 14:00:21.779  3488  4410 E SensorService: getSensorList a sensor (HRM Ambi
ent Light Canceling) without holding its required permission: com.samsung.permis
sion.HRM_EXT
01-03 14:00:21.779  3488  4410 E SensorService: getSensorList a sensor (HRM Prox
imity detecting) without holding its required permission: com.samsung.permission
.HRM_EXT
01-03 14:00:21.779  3488  4410 E SensorService: getSensorList a sensor (HRMLED I
R) without holding its required permission: android.permission.BODY_SENSORS
01-03 14:00:21.779  3488  4410 E SensorService: getSensorList a sensor (HRMLED R
ED) without holding its required permission: android.permission.BODY_SENSORS
01-03 14:00:21.779  3488  4410 E SensorService: getSensorList a sensor (MAX86900
) without holding its required permission: com.samsung.permission.SSENSOR
01-03 14:00:21.779  3488  4410 E SensorService: getSensorList a sensor (HRM Sens
or) without holding its required permission: com.samsung.permission.SSENSOR
01-03 14:00:21.779  3488  4410 E SensorService: getSensorList a sensor (HeartRat
e Sensor) without holding its required permission: android.permission.BODY_SENSO
RS
01-03 14:00:22.039  3056  3706 E NetlinkEvent: NetlinkEvent::FindParam(): Parame
ter 'LABEL' not found
01-03 14:00:22.039  3056  3706 E NetlinkEvent: NetlinkEvent::FindParam(): Parame
ter 'UID' not found
01-03 14:00:22.829 19184 19220 E         : g2d stretchFimgApi_v5 function does n
ot exist
01-03 14:00:22.829 19184 19220 E         : [JM] stretchFimgApi might be v4.
01-03 14:00:22.829  3488  3488 E MotionRecognitionService: GripVal = 0
01-03 14:00:23.999  3488  4271 E Watchdog: !@Sync 295 [01-03 14:00:24.006]
01-03 14:00:26.699  3488  3488 E MotionRecognitionService: support TA ~
01-03 14:00:31.479  8520  8520 E SamsungIME:          isHWKeyboardConnected() =
false --> false
01-03 14:00:32.659  3056  3706 E NetlinkEvent: NetlinkEvent::FindParam(): Parame
ter 'LABEL' not found
01-03 14:00:32.659  3056  3706 E NetlinkEvent: NetlinkEvent::FindParam(): Parame
ter 'UID' not found
01-03 14:00:33.039  3488  3488 E MotionRecognitionService: disableGripSensor, ba
ckoffstate = 33792
01-03 14:00:33.039  3488  3940 E MotionRecognitionService: handleMessage: event
200 value : 33792

===========================

For some reason, scaleFactor is reduced to 0.75 when it should be 1.0

As always let me know any necessary information.

 

0 Kudos
PaulF_IntelCorp
Employee
940 Views

I've sent you a private message requesting a copy of your app so we can see if we can reproduce what you are describing.

0 Kudos
Giselle_G_Intel
Employee
940 Views

Juan Pablo,

We ran the provided test app that you sent and were not able to recreate what you are seeing. We see the "game" with the margin as soon as we install and open the app - not the fullscreen view that is first seen in your video.

We believe that this has more to do with the way Construct 2 is defining the stage view. We also noticed that the fullscreen plugin was not in the test zip. The fullscreen plugin removes the status bar, so regardless we would not see a difference in stage size. We advise that you look at your defined view dimensions (height and width) and see if the modification of those helps your window size.

Best of luck! 

0 Kudos
Campuzano_Serna__Jua
940 Views

Giselle G. (Intel) wrote:

Juan Pablo,

We ran the provided test app that you sent and were not able to recreate what you are seeing. We see the "game" with the margin as soon as we install and open the app - not the fullscreen view that is first seen in your video.

We believe that this has more to do with the way Construct 2 is defining the stage view. We also noticed that the fullscreen plugin was not in the test zip. The fullscreen plugin removes the status bar, so regardless we would not see a difference in stage size. We advise that you look at your defined view dimensions (height and width) and see if the modification of those helps your window size.

Best of luck! 

Hi, thanks for your time, the plugin I have not included it because it never had any effect on my tests, I mean I never avoided the problem of full screen loss.

Previously I commented that this problem also happens if I compile without using crosswalk, does this mean that it could be an android or webview problem ?.

0 Kudos
Giselle_G_Intel
Employee
940 Views

Well, when we ran it - both with crosswalk and without crosswalk - we saw no change. As in, we saw the view with the margins from the moment we installed and opened it. There was no change seen between the initial opening and the restart. Which we interpreted as a Construct 2 issue, not an issue in the XDK. What we believe the issue is, is that Construct 2 is interpreting your webview dimensions. Beyond that, we really can't say what the problem might be, unfortunately.

0 Kudos
Campuzano_Serna__Jua
940 Views

Giselle G. (Intel) wrote:

Well, when we ran it - both with crosswalk and without crosswalk - we saw no change. As in, we saw the view with the margins from the moment we installed and opened it. There was no change seen between the initial opening and the restart. Which we interpreted as a Construct 2 issue, not an issue in the XDK. What we believe the issue is, is that Construct 2 is interpreting your webview dimensions. Beyond that, we really can't say what the problem might be, unfortunately.

Ok, thanks for the support, it's great.
I'll see what I can do with this.
Regards!.

0 Kudos
Reply