Director::getInstance()->getOpenGLView()->getFrameSize() wrong when I restart the device

This was on a samsung galaxy s7 android 6.0.1

When I install my game for the first time on this device, getFrameSize returns correctly (2560x1440)

If I close the app and launch it again it still returns the correct resolution.

but when I close then app, turn off my phone on again and re-open the app, the resolution is now 1920x1080.

Then if I close the app and turn off my phone on and re-launch the game it’s now 2560x1400 or 1920x1080 it’s random…

Also if I get the wrong resolution and delete the app and re-install it, it is now the right resolution.

Has anyone seen this issue before? I am using cocos2dx coco3.15

I just tried a blank hello world app and I tried on a samsung tab s2 with android version 6.0.1. Same issue. I also tried building against different android platform like android-17 and android-22. I had to restart the device 3-4 times some times to reproduce the issue. I tried with an Ipad air simulator by installing the app then completely closing the simulator and turn it back on again a bunch of times but I was not able to reproduce this issue on ipad.

Anyone have any idea?

Hi @ericb365

Interesting…
What if you restart the phone and run the project only after 2-5 minutes (in other words, give the system enough time to initialize in the background)?

If this helps, then this is not too critical issue (still an issue though), since the probability that the user will restart the phone and immediately start your game is low.

@brightInverse the issue is still happening even tho I waited 5 minutes

5 minutes with the active screen, right?
Something like a restart and 5 minutes to surf the Internet.

Yes I just tried again. Clean install, launched it resolution was as expected, then I restart the device, surf the internet for 5 mins, launched the app and the resolution is not right…

Ok, I looked at the source code and I think that I can write a program to reproduce it in a pure android project, not cocos2d-x. Because I think that the Samsung will not care about a bug that happens only in some engine.
But keep in mind that I am not a very well android programmer.

If the problem is confirmed in a pure android project, then I think that the best option is to write to the Samsung support service. Before that, it is better to register as a Samsung developer. And write exactly to the support, because their forum is not very useful.

If the issue will not confirmed in a pure android project, then I will ask Mingo to look at this.

Awesome thank you. I tried 2 samsung devices (stated above) but I think it would be best to use a high resolution android device (like 2560x1440 for example) to see if it would happen again. I tried on lower resolution android device and I did not see the same problem. Edit: It’s hard to say whats the problem. Maybe it’s android 6.0.1 or even cocos2dx 3.15… or samsung lol

Yes, apparently this issue is only with the latest devices from Samsung (S7, S8). Maybe LG too.

Only there is one problem, I do not have these devices to check if the issue persists.
When I finish with the program, I can send you an apk or source code for testing. Is it OK?

I remember mentioning a similar problem on these devices, I think it was even before 3.15.
And I looked at the source code now and I think that the problem really is in the devices. The best way to find out is to check it out.
If you do not want to receive files from me, I can just instruct you how to write the program to check.
Because I am interested in good supporting these devices too.

I don’t mind testing the apk for you :slight_smile: I think on s7 if you update to android 7 you can change the resolution in the settings on your phone. But in android 6 you can’t do that.

Then you are right, maybe this is the problem with the android version.
I will write the program early next week, and will send you the apk and source codes, just in case.

1 Like

If it will help. I’m in office again at 28. August and we do have a Galaxy S8 there. Just if you need to test something on this device too.

1 Like

Nice. Thank you!

1 Like

I sent the files to both.
I think that will be better to publish the results here, in case anyone else face this issue.