cordova-plugin-orientation

Share your advanced knowledge/code with the community.
falsam
Posts: 280
Joined: Mon May 05, 2014 9:49 pm
Location: France
Contact:

cordova-plugin-orientation

Post by falsam »

Practice with Cordova : Get current orientation.

■ Platform
Android
iOS

■ Documentation : https://www.npmjs.com/package/cordova-p ... rientation

Code: Select all

Enumeration
  #mf
  #mfOrientation
EndEnumeration

Declare Start()
Declare OnResize()

;No debug
CloseDebugOutput()

ExamineDesktops()

;Import Cordova Plugin
Import "cordova plugin add cordova-plugin-orientation"
EndImport

Start()

Procedure Start()
  Protected Font = LoadFont(-1, "Arial", 16)
  
  OpenWindow(#mf, 0, 0, 0, 0, "Orientation", #PB_Window_Background)
  TextGadget(#mfOrientation, 20, 20, 400, 24, "")
  SetGadgetFont(#mfOrientation, FontID(Font))
  OnResize()
  
  BindEvent(#PB_Event_SizeDesktop, @OnResize())  
EndProcedure

Procedure OnResize()
  Protected Orientation.s
  Protected Width = DesktopWidth(0)
  Protected Height = DesktopHeight(0)
  
  !v_orientation = screen.orientation.type
  SetGadgetText(#mfOrientation, Orientation)
  
  ResizeWindow(#mf, 0, 0, Width, Height)
EndProcedure

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

Sorry for my poor english
plouf
Posts: 194
Joined: Tue Feb 25, 2014 6:01 pm
Location: Athens,Greece

Re: cordova-plugin-orientation

Post by plouf »

Nice one Works here nexus 5 android 6
Christos
Post Reply