GLBasic forum

Main forum => Bug Reports => Topic started by: adaz on 2018-Feb-16

Title: ANDROID - Immersive full screen question (MOUSESTATE issue)
Post by: adaz on 2018-Feb-16
Hi Guys!

BOXCOLL returns false values on the bottom of the screen, I think because of the virtual navigation controls of Android. See the image.

I don't know how to tell Android that I want immersive full screen, where the navigation controls don't bother me.

How to insert this code into GLBasic?
https://developer.android.com/training/system-ui/immersive.html (https://developer.android.com/training/system-ui/immersive.html)

Can somebody help me please?
Title: Re: ANDROID - Immersive full screen question
Post by: dreamerman on 2018-Feb-16
If no navigation bar is shown then thats 'immersive' mode? So GLBasic does that by default (or it needs AndroidExtras or some manifest file changes, don't remember)..
To validate that issue you can give even some small source ready to compile and test, do you use orientation/screen rotation functions, any other special stuff or just basics? If touch controls responds with proper x y positions there should be no problem. On other hand I use hand written collision functions, that's only couple minutes of coding and much more handy if you have UDT, at least for me.
Title: Re: ANDROID - Immersive full screen question
Post by: erico on 2018-Feb-16
Using the screen fit routine SpaceFractal did a while ago gives me no problems.
As with the extra menus, I get a shadow version of it that don´t bother me with my phone or with the ones I tried.
I also took note of some ways to disable the <back> and <menu> buttons so one does not accidentally touch it exiting the game.

Make a simple example apk, like Dreamerman said, so we can also test that out for you.
cheers.
Title: Re: ANDROID - Immersive full screen question
Post by: adaz on 2018-Feb-17
Ok Guys, here is an example project. It draws a horizontal line exactly where I touch the screen. But it is only true until I touch the bottom of the screen.

Code (glbasic) Select
GLOBAL mx,my,mb1,mb2

LOADFONT "Media/white.png",1
SETFONT 1

REPEAT
MOUSESTATE mx,my,mb1,mb2
IF mb1 THEN DRAWLINE 0,my,5000,my,RGB(255,255,255)
PRINT "TOUCH Y:"+my,200,0
SHOWSCREEN
UNTIL 0=1


(I attached the font (it has to be copied to Media folder), and I attached the compiled .apk as well.)

So, what I am experiencing is the following:

1. When I touch the very bottom (approx. 1 cm) of the screen on the phone, the white line does not appear.
2. When I begin to push my finger slowly upwards, the line appears at the very bottom (!!) of the screen. But my finger is already not there, my finger is approx. 1 cm upper than that.
3. When I continue to push my finger upwards, the line begins to approach my finger, and on the top it reaches it.

I don't know if it is understandable, or if you can regenerate this issue on your phones, so I'm very curious. Does it happen only on my phone, or it's a bug? (I have a Huawei P10)

Thank you very much!

EDIT: I already tried to disable Back button. The back button was really disabled, but that did not help as well...
Title: Re: ANDROID - Immersive full screen question
Post by: erico on 2018-Feb-17
Is that the whole code?
I think GETDESKTOPSIZE will return the usable only area of the phone and one can scale its game accordingly, but then that would not be full screen as you want. I have no phone with in-menu close by now but will try to look for some.
Title: Re: ANDROID - Immersive full screen question
Post by: adaz on 2018-Feb-17
Thanks erico. It still does not work, I've tried everything I think.

Another try was to achieve somehow that the navigation bar be always visible. If it solved my problem, I'd be in peace with it. But I could not dissuade AE to hide the navigation bar. I cleared every flags from the SDLActivity.java (like View.SYSTEM_UI_FLAG_LAYOUT_STABLE, etc.), but the bar is still hidden... Do you have an idea for this?
Title: Re: ANDROID - Immersive full screen question
Post by: dreamerman on 2018-Feb-17
So, that's no an issue with BOXCOLL but some screen / navigation bar problem.
I checked that .apk on
- phone with Android 6.0, hardware buttons, both software bars (navigations and status) are invisible, line is drawn at proper position, so no issues,
- old tablet with Android 4.0 that has software bars always enabled, and they are visible in this app, (navigation bars are also visible in other GLB based apps, status bar isn't visible, but imerssive mode is available from Android 4.4),
Currently no other devices to test. I didn't play with Android from long time so can't help with such os based stuff atm.
Title: Re: ANDROID - Immersive full screen question
Post by: adaz on 2018-Feb-17
Thanks anyway dreamerman. As I said now I'd be happy with visible navigation bars (if nothing else works), but I cannot make them visible. Can you help in this?
Title: Re: ANDROID - Immersive full screen question
Post by: erico on 2018-Feb-18
This here is what I use:
http://www.glbasic.com/forum/index.php?topic=9848.0

Check the whole thread couse I can´t remember if there was a little bug somewhere.
Last time I tested using this system, bars where a bit visible (transparent) and coordinates worked fine, you can then check on disabling MENU and BACK so it pauses instead of exiting the app. Take a look.
Title: Re: ANDROID - Immersive full screen question
Post by: adaz on 2018-Feb-18
Quote from: erico on 2018-Feb-18
This here is what I use:
http://www.glbasic.com/forum/index.php?topic=9848.0

Thanks erico, but I don't know what to do with that code, this is not about my problem. My problem is that my Huawei doesn't allow me to touch the bottom section at all, even if the software buttons are invisible.
Today I was able to try my test code on another phone, and it worked on that, but it has hardware buttons:(
I tried some other games on my Huawei, and they allowed me to touch the bottom section as well, so it IS possible somehow, but I still don't know what to do to achieve this.
Title: Re: ANDROID - Immersive full screen question
Post by: MrPlow on 2018-Feb-18
Hi


[edited scaling comment - not relevant]

I didn't read the issue correctly :)

Maybe your touch is being registered but not shown in the right place.
Why not add another feedback response in a fixed location, to the show the screen accepting the touch (even if not in the correct position).



Title: Re: ANDROID - Immersive full screen question
Post by: spacefractal on 2018-Feb-18
Android does not report the screen resolution where the system buttons is, so you might cannot use the full screen. That is pretty normal and is nothing im can do with it. This is just how onscreen buttons works. So this is by Android design.

Im will also not fix the the Immersive screen for Android 4.4, due the userbase is very small today, and im have stopped Android support anyway. The issue is property in SDLActivity.Java mouse code, which is not aware of the Immersive screen and "orientations" changes.

Android 5+ fullscreen should howover do works fine.

PS. This is not a scaling issue, but mousestate issue. scaling and boxcoll have nothing about it at all.
Title: Re: ANDROID - Immersive full screen question
Post by: MrPlow on 2018-Feb-18
Oops - yep, didn't read the issue correctly, so I went on a tangent with scaling....  :S



Title: Re: ANDROID - Immersive full screen question
Post by: erico on 2018-Feb-18
Yep, the scaling part was not what I wanted to point but the part that detects screen size and convert touch coordinates accordingly.
Title: Re: ANDROID - Immersive full screen question
Post by: spacefractal on 2018-Feb-18
still, this issue is NOTHING about scaling and converting coordinates at all. Dont been confused here. This is a MOUSESTATE issue.

The main issue is simply is the java code does simpley not take and aware the feature have been set or not and then glbasic does not take any notice at all when screen configuration change, etc its techinal change onscreen resolution.

That means, when you switch to Immersive screen, then the resolution also changes too, that does property not happens and then MOUSESTATE fails and still thinks the resolutions is in normal mode. hence its freak out. This is what im thinking. Im have property tried to get it working, but did newer got it working, so im skipped the feature. Android 5.0 fullscreen was much easier to support.

Howover im will not fix this issue, since its only effect Android 4.4 and fullscreen from Android 5 can been used.

the issue is property rely in SDLActivity.Java and eventuelly in Androidmanifest.xml. The issue should also exists only for Android 4.4...... Fullscreen IS supported from Android 5.0 and up. Also im did also fixed a simular issue, which im thinks its was a Android TV issue about this one.

So this can actuelly by a bug, but im wont fix it.

Title: Re: ANDROID - Immersive full screen question
Post by: adaz on 2018-Feb-18
Thank you spacefractal and guys. I already compiled this code for Android 5.1.1, API level 22, so it should work as you said. But it doesn't :( Do you have an idea where that "bug" could be, maybe I can try to fix it?

EDIT:
It's strange:
"aapt dump badging" command says:

package: name='com.company.title' versionCode='1' versionName='1.00' platformBuildVersionName='5.1.1-1819727'
install-location:'preferExternal'
sdkVersion:'9'
targetSdkVersion:'19'

How can it be?
Title: Re: ANDROID - Immersive full screen question
Post by: spacefractal on 2018-Feb-18
checkout your androidmanifest.xml, which require changes.

targetSdkVersion is wrong and think you still using Android 4.4 SDK, where fullscreen feature is not present. targetSdkVersion should set to the current SDK using. If you update and fixing, then targetSdkVersion should set target to that.

here is the manifest im used for CatchOut, before im stopped:

Code (glbasic) Select

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="xxx.spacefractal.catchout"
      android:installLocation="preferExternal"
      android:versionCode="3"
      android:versionName="1.02">
    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<supports-screens android:resizeable="false"
  android:smallScreens="false"
  android:normalScreens="true"
  android:largeScreens="true"
  android:xlargeScreens="true"
  android:requiresSmallestWidthDp="400"
  android:anyDensity="true" />
    <application android:label="@string/app_name" android:icon="@drawable/icon" android:debuggable="false">
<meta-data android:name="TVOnly" android:value="0" />
<meta-data android:name="UseShop" android:value="0" />
        <activity android:name="org.libsdl.app.SDLActivity"
android:label="@string/app_name"
android:screenOrientation="sensorLandscape"
android:configChanges="orientation|keyboardHidden|screenLayout|uiMode|screenSize"
>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
<category android:name="tv.ouya.intent.category.GAME" />
            </intent-filter>
        </activity>
    </application>
</manifest>


There is also various Android TV as well OUYA stuff you might can remove..... There was also a crash bug in eailer Android Extras on some devices, when the OuyaSDK is present. that is fixed and will simply not init it, when its not on Ouya. You can also eventuelly remove all those stuff in onCreate().
Title: Re: ANDROID - Immersive full screen question
Post by: adaz on 2018-Feb-18
It was my mistake, I didn't notice an error message after compile, so I used an old apk. Now it really compiled to api 22:

package: name='com.adaz.antirock' versionCode='1' versionName='1.00' platformBuildVersionName='5.1.1-1819727'
install-location:'preferExternal'
sdkVersion:'10'
targetSdkVersion:'22'

But the same MOUSESTATE issue still extists :-(
Title: Re: ANDROID - Immersive full screen question
Post by: spacefractal on 2018-Feb-18
1. do you use sensorLandscape or sensorPortrait in manifest (not set to any orientation or such, which might fail too)? dont use other values than one of the two.

2. Does X also the same (your code only show Y, but what does X)?

3. Also can you give me the Logcat output? (can been called from _Logview.bat). This logout various info on startup.

4. do you use Android Extras 3.01.2?
http://www.glbasic.com/forum/index.php?topic=9644.0

if you in LOGCAT can see Screen Resolution is different than SDL resolution, its could been that issue. This was more designed for Android TV and not on a device.

Then you can try to comment those two Java lines out in around line 1885 (its in onTouch() function):
         if (SDLActivity.mSingleton.ViewWidth!=0) x=x/SDLActivity.mSingleton.ViewWidth;
         if (SDLActivity.mSingleton.ViewHeight!=0) y=y/SDLActivity.mSingleton.ViewHeight;


That why im want to checkout the Logcat to information what its does in the startup.....

please note:
Android 4.x system will also only report the screen resolution in the screen area you can use for your app. THIS IS BY DESIGN. Immersive fullscreen in Android 4.4 is not supported by glbasic, nor its ever do. But fullscreen from Android 5 is howover supported.

PS. Yes even im did stopped Android support, then im might eventuelly fix SDLActivity issues like this. But new features and SDK updates wont been happens for supports new Android features.
Title: Re: ANDROID - Immersive full screen question
Post by: adaz on 2018-Feb-18
Spacefractal, you're very kind by helping me in this!

1. I used portrait, but now I tried it with sensorPortrait, no luck.

2. X does nothing wrong, it's OK.

3. Logcat output:

Code (glbasic) Select
Android Debug Bridge version 1.0.32
List of devices attached
7EX7N17803000238        device

int logctl_get(): open '/dev/hwlog_switch' fail -1, 13. Permission denied

Note: log switch off, only log_main and log_events will have logs!
--------- beginning of main
02-18 23:48:51.888 30161 30161 I glbasic : OnResume()
02-18 23:48:51.889 30161 30161 I glbasic : OnResume() end
02-18 23:48:51.903 30161 30161 I glbasic : surfaceCreated()
02-18 23:48:51.907 30161 30161 I glbasic : surfaceChanged()
02-18 23:48:51.907 30161 30161 I SDL     : pixel format RGB_565
02-18 23:48:51.907 30161 30161 I glbasic : Window size:929x1560
02-18 23:48:51.907 30161 30161 I glbasic : startApp, resume
02-18 23:48:51.907 30161 30161 I glbasic : startApp, resume 1
02-18 23:48:51.907 30161 30161 I glbasic : startApp, resume 4
02-18 23:48:51.907 30161 30200 I SDL     : ceateGLContext
02-18 23:48:51.907 30161 30161 I glbasic : hint screensize to glb
02-18 23:48:51.907 30161 30161 I glbasic : glb_notify_screen_size 929x1560
02-18 23:48:52.409 30161 30200 I glbasic : pause loop ended
02-18 23:49:04.560 30161 30161 I glbasic : OnPause()
02-18 23:49:04.574 30161 30200 I glbasic : pause loop in showscreen/hibernate
02-18 23:49:04.609 30161 30161 I glbasic : surfaceDestroyed()


4. Yes, I do. I removed the old one, and downloaded from the link you provided. (How can I check its version? In the chm file it says 2.8.)
I don't know what is SDL resolution. The phone reports 929x1560 every time.

Thank you!

EDIT: I read your inserted lines later. So after I commented out these lines, something happened: the lines are WAY FAR from my fingers now. The top left is OK, but when I approach the bottom left, they reach the screen edges much sooner than before.
Title: Re: ANDROID - Immersive full screen question
Post by: spacefractal on 2018-Feb-19
Can you try this Java file?

Its proprety some Android TV that kick in and you using fullhd in a portrait mode, which im have set a default max. Mousestate should have works anyway, but might have failed with the mousestate, which im should checkout here. but anyway its now not forced anymore. Only when contain string is set in strings.xml.

Make sure to overwrite that one that is inside glbasic android folder (search after that in the glbasic folder). Not in your app distrubtion folder. Glbasic will overwrite (unlike the manifest file).
Title: Re: ANDROID - Immersive full screen question
Post by: spacefractal on 2018-Feb-19
Ahhh,  I'm know why that happens. Actuelly it's a confirmed bug.

That Java file Should fix it, but not in 100% correct way around android TV/ouya scaling stuff, which got kicked in and Should skip it when it's in portrait mode, which its did not. But the Java thing it howover no more forced anyway in above file, except when a string in string.xml is set.

It's a stupid bug really. Nice spotted. I'm do a better fix later (even I'm stopped android support, except thing like this).
Title: Re: ANDROID - Immersive full screen question (MOUSESTATE issue)
Post by: spacefractal on 2018-Feb-19
Im have in this morning removed all AndroidTV scaling code, so its dont interfere normal devices, actuelly forced 720p is only happens on Ouya and GameStick. Android 5 devices TV is normally quite much faster than Android 4 consoles anyway.

Im have updated the Android update thread in the top. here only the java file is requried update. Howover its wont fix the issue in the bottom about system buttons, as im wrote due system.

Howover im will not support the Immersive Android 4.4, you need to have the system buttons, which is also pretty normal way.

Make sure to make a proper use of the back button eventuelly.
Title: Re: ANDROID - Immersive full screen question (MOUSESTATE issue)
Post by: adaz on 2018-Feb-19
Spacefractal, YOU ARE A GENIUS!!! It's working!!! I cannot say how happy I am! This SDLActivity.java resolved this problem. I don't know what you did, but you did it!
So what did you do? :)
Title: Re: ANDROID - Immersive full screen question (MOUSESTATE issue)
Post by: spacefractal on 2018-Feb-19
removed Android TV scaling stuff.... its effected this issue, mostly im did set a scalling max in y 1560 resolution. this happens easy in portrait mode. Then its try to scaling it.... but the code did not take system button area at all, but returned as its was full screen. Then mousestate returns wrong.

Also Android TV stuff do require Landscape anyway.
Title: Re: ANDROID - Immersive full screen question (MOUSESTATE issue)
Post by: adaz on 2018-Feb-19
I see, thank you again very much!!