Create Android App Fullscreen

Everything else that doesn't fall into one of the other categories.
IdeasVacuum
Posts: 143
Joined: Tue Feb 25, 2014 1:27 pm

Create Android App Fullscreen

Post by IdeasVacuum »

In Create App, there is a Fullscreen option next to the primary orientation option. I assumed it meant that my app window would be auto-sized to fit the device screen, but that doesn't happen.
  • What then, is that option for?
    Can or could the Desktop Library be used (DesktopHeight/DesktopWidth) to size a Window for the Android device?
    Or could we have the #PB_Window_Maximize flag that PB has for Windows applications?
It's quite rare for an app not to command the whole screen on smartphones and tablets.

Edit: If Create App/Android/Fullscreen is not picked I get a Compiler error:
[COMPILER] Can't deploy the app: [INSTALL_FAILED_VERIFICATION_FAILURE].
Last edited by IdeasVacuum on Sat Jun 10, 2017 2:08 pm, edited 1 time in total.
IdeasVacuum
Posts: 143
Joined: Tue Feb 25, 2014 1:27 pm

Re: Create Android App Fullscreen

Post by IdeasVacuum »

So, found this: http://ryanve.com/lab/dimensions

.... but I don't know how to use it in SB:

Code: Select all

Global igAvailW.i, igAvailH.i, igWinH.i, igWinW.i

!igAvailW = window.screen.availWidth
!igAvailH = window.screen.availHeight
!igWinW = window.screen.width
!igWinH = window.screen.height

Debug igAvailW
Debug igAvailH
Debug igWinW
Debug igWinH
IdeasVacuum
Posts: 143
Joined: Tue Feb 25, 2014 1:27 pm

Re: Create Android App Fullscreen

Post by IdeasVacuum »

ExamineDesktops() works!
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Create Android App Fullscreen

Post by Peter »

IdeasVacuum wrote:ExamineDesktops() works!
ExamineDesktops() is a dummy - function and exists only for code-compatibility with PureBasic. ;-)

Code: Select all

function spider_ExamineDesktops() {
    return 1
}
Greetings ... Peter
IdeasVacuum
Posts: 143
Joined: Tue Feb 25, 2014 1:27 pm

Re: Create Android App Fullscreen

Post by IdeasVacuum »

..... that must have changed Peter because the following code results in the window fitting my smartphone screen precisely?

Code: Select all

EnableExplicit
CloseDebugOutput()
ExamineDesktops()

#Desktop = 0

Enumeration
#Win
#Btn1
#Btn2
#Btn3
#BtnExit
#Scroll
#Msg
#Txt
EndEnumeration

Global igAvailW.i, igAvailH.i, igWinH.i, igWinW.i

;!igAvailW = window.screen.availWidth
;!igAvailH = window.screen.availHeight
;!igWinW = window.screen.width
;!igWinH = window.screen.height

igWinW = DesktopWidth(#Desktop)
igWinH = DesktopHeight(#Desktop)

;Debug igAvailW
;Debug igAvailH
;Debug igWinW
;Debug igWinH

Procedure CloseWindowEvent()
;#---------------------------
  CloseWindow(EventWindow()) ; Close the specific window
EndProcedure

Procedure MyGadgetEvent()
;#------------------------
    SetGadgetText(#Msg, "Button" + Str(EventGadget()) + " pressed!")
EndProcedure
 

  If OpenWindow(#Win, 0, 0, igWinW, igWinH, "", #PB_Window_BorderLess|#PB_Window_ScreenCentered)

    ScrollAreaGadget(#Scroll,   0,   0, igWinW, igWinH, 1920, 1080, 40)
        ButtonGadget(#Btn1,    10,  10, 255,  38,"Button 1")
        ButtonGadget(#Btn2,    10,  50, 255,  38,"Button 2")
        ButtonGadget(#Btn3,    10,  90, 255,  38,"Button 3")
        ButtonGadget(#BtnExit, 10, 130, 255,  38,"Exit")
          TextGadget(#Msg,     10, 180, 255,  26, "", #PB_Text_Center | #PB_Text_Border)
          TextGadget(#Txt,    200, 210, 230,  26, "Scroll to see all of the Text Here", #PB_Text_Right | #PB_Text_Border)

           BindEvent(#PB_Event_Gadget, @MyGadgetEvent(), #Win, #Btn1)
           BindEvent(#PB_Event_Gadget, @MyGadgetEvent(), #Win, #Btn2)
           BindEvent(#PB_Event_Gadget, @MyGadgetEvent(), #Win, #Btn3)
           BindEvent(#PB_Event_Gadget, @CloseWindowEvent(), #Win, #BtnExit)

     CloseGadgetList()

  EndIf
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Create Android App Fullscreen

Post by Peter »

interesting! It seems, that the compilers generate target-specific code.

Could you be so kind and execute the following code on your device?

Code: Select all

Define F.s
! v_f = eval(spider_ExamineDesktops).toString();
Debug F
Thanks in advance & Greetings ... Peter
falsam
Posts: 280
Joined: Mon May 05, 2014 9:49 pm
Location: France
Contact:

Re: Create Android App Fullscreen

Post by falsam »

IdeasVacuum wrote:ExamineDesktops() works!
Hum i think this is not the real screen resolution.

On my device, DesktopWidth() return 360. My real screen width is 1280 ;)

➽ Windows 11 - JDK 1.8 - SB 2.40 - Android 13
http://falsam.com

Sorry for my poor english
IdeasVacuum
Posts: 143
Joined: Tue Feb 25, 2014 1:27 pm

Re: Create Android App Fullscreen

Post by IdeasVacuum »

Peter:
function spider_ExaminDesktops() {return 1}
:cry:

falsam:

Code: Select all

ExamineDesktops()

Debug DesktopWidth(0)
Debug DesktopHeight(0)
640
335
:shock: (Actual: 960*540)
...but why does DesktopWidth/DesktopHeight return values?

So guys - what is the solution? How can I ensure that my app is fullscreen?
falsam
Posts: 280
Joined: Mon May 05, 2014 9:49 pm
Location: France
Contact:

Re: Create Android App Fullscreen

Post by falsam »

[SB 2.00] Orientation : Any - Fullscreen : check

I'm trying to test this code.

Code: Select all

Enumeration
  #mf
  #mfResolution0
  #mfResolution1  
  #mfExit
EndEnumeration

Declare Start()
Declare onChangeOrientation()
Declare Exit()

;No Zoom
!$('head').append('<meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=0">');

Start()

Procedure Start()
  Protected font = LoadFont(#PB_Any, "", 22), Gadget
  
  CloseDebugOutput()
  OpenWindow(#mf, 0, 0, 0, 0, "", #PB_Window_Background)
    
  Gadget = TextGadget(#PB_Any, 10, 20, 150, 40, "Resolution")
  SetGadgetFont(Gadget, FontID(font))
  
  TextGadget(#mfResolution0, 250, 20, 200, 40, "")
  SetGadgetFont(#mfResolution0, FontID(font))
  
  Gadget = TextGadget(#PB_Any, 10, 70, 150, 40, "ExamineDesktop()")
  SetGadgetFont(Gadget, FontID(font))
  
  TextGadget(#mfResolution1, 250, 70, 200, 40, "")
  SetGadgetFont(#mfResolution1, FontID(font))
 
  
  ButtonGadget(#mfExit, 0, 20, 100, 40, "Exit") 
  SetGadgetFont(#mfExit, FontID(font))
   
  onChangeOrientation()
  
  !navigator.vibrate(1000);
  
  BindGadgetEvent(#mfExit, @Exit())
  BindEvent(#PB_Event_SizeWindow, @onChangeOrientation())
EndProcedure

Procedure onChangeOrientation()
  Protected width, height
  
  ExamineDesktops()
  
  !v_width = screen.width * window.devicePixelRatio;
  !v_height = screen.height * window.devicePixelRatio;
  
  !document.body.style.zoom = 1 / window.devicePixelRatio * 100 + "%"
  
  ResizeWindow(#mf, #PB_Ignore, #PB_Ignore, width, height)
  ResizeGadget(#mfExit, WindowWidth(#mf) - 120, #PB_Ignore, #PB_Ignore, #PB_Ignore)
  
  SetGadgetText(#mfResolution0, Str(width) + " / " + Str(height))
  SetGadgetText(#mfResolution1, Str(DesktopWidth(0)) + " / " + Str(DesktopHeight(0)) )
  
EndProcedure

Procedure Exit()
  !window.close();
EndProcedure

➽ Windows 11 - JDK 1.8 - SB 2.40 - Android 13
http://falsam.com

Sorry for my poor english
IdeasVacuum
Posts: 143
Joined: Tue Feb 25, 2014 1:27 pm

Re: Create Android App Fullscreen

Post by IdeasVacuum »

Resolution 540/960
Examine Desktop 360/640

.... Procedure Exit looks interesting too!

With Fullscreen set, I thought Android would resize the window and gadgets on orientation change. Oh well.
Post Reply