B4A Tutorial Orientation and accelerometer - Erel    Apr 28, 2020   (12 reactions)   tags: sensors The attached program displays the values of the different sensors: http://www.b4x.com/basic4android/images/sensors.png It creates a PhoneSensors object for each type of sensor. As you can see in the attached code, two Maps are used to hold the phone sensors and the other required data. This way there is no need to write any duplicate code. A better method for finding the orientation values: https://www.b4x.com/android/forum/threads/orientation-and-accelerometer.6647/page-6#post-476271... B4A Question Persist webview through orientation change - barx    Feb 5, 2014 Is there a way in b4a to persist a webview when the orientation is changed? We can obviously get the url and reload it, but what if the user has entered some data and then decides to rotate. All is lost. Searching on net shows the use of manifest edit android:configChanges="orientation|screenSize" but it requires onconfigurationchange() something that doesn't seem to be inplemented in b4a Another option documented in java is to protected void onSaveInstanceState(Bundle... B4i Code Snippet [beta] Forcing the app orientation at runtime - Erel    Mar 3, 2024   (7 reactions) Add to main module:
#if OBJC
@end
@interface B4IAppDelegate (orientation)
@end
@implementation B4IAppDelegate (orientation)
- (UIInterfaceOrientationMask)application:(UIApplication *)application
supportedInterfaceOrientationsForWindow:(UIWindow *)window {
return ._morientation;
}
#End If
Public Sub SetSupportedOrientation(Orientation As Int)
mOrientation = Orientation
If App... B4A Question Phone Sensor Orientation x starting point - Scantech    Jun 23, 2019 Is Phone Sensor Orientation Type X value ranges from 0 to 360? x seems a bit off. Do we have to calibrate it to have it set at x = 0 when phone is portrait mode?... B4A Question Does this method for restarting a B4XPages App with a different orientation work in Android 8+? It works in Android 7.0. - William Lancee    Dec 1, 2021   (1 reaction) an orientation, this orientation can be determined at run time, as long as the commitment occurs before B4XPagesManager is Initialized. If a timer finds that (by using the sensors) the orientation has changed, the App can be stopped and restarted with a new orientation. The effect is as if the app has paused... sensing orientation change is extracted from @emexes: https://www.b4x.com/android/forum/threads/detect-screen-rotation-with-portrait-orientation.106872/post-669094 P.S. Ignore log message about... B4A Code Snippet [B4XPages] Lock screen orientation based on how device is held when App is started. - William Lancee    Oct 2, 2021   (3 reactions) I have an App that can handle both orientations, so I wanted the user's preference to be reflected in how the App was oriented. I searched the Forum, but I couldn't find what I needed. In...... #SupportedOrientations: unspecified Sub Activity_Create(FirstTime As Boolean) 'set... #SupportedOrientations: unspecified Dim ph As Phone If Activity.width < Activity.Height Then ph.SetScreenOrientation(7) Else ph.SetScreenOrientation(6) Dim pm As B4XPagesManager pm.Initialize... Share My Creation Object Oriented Pong - Full Source - wonder    Oct 13, 2016   (11 reactions) 48901 My A.I. algorithm: 'The zero plus below is for code beautification purposes only. :) Dim stress = 1 - (Abs(x - ball.PosX) / court.width) As Double Dim confidence = 0 + (Abs(y - ball.PosY) / getHeight ) As Double Dim fitness = If_ (ball.PosY < y, -lv, lv) As Double vY = Abs(ball.VelocityY * 3) y = y + (vY * stress * confidence * fitness) 'If the ball is above t... B4A Code Snippet [B4XPages]Dynamically switching screen orientation while using B4XPages - William Lancee    Dec 3, 2021   (4 reactions) The idea is to detect orientation dynamically and when it changes - restart the App so that B4XPages is initialized with the new orientation. The App state can be saved and reloaded. Update...-this-method-for-restarting-a-b4xpages-app-with-a-different-orientation-work-in-android-8-it-works-in-android...: TestOrient #VersionCode: 1 #VersionName: 'SupportedOrientations possible values: unspecified, landscape or portrait. #SupportedOrientations: unspecified 'IMPORTANT... B4A Question [B4X] B4XPages - Locked orientation limitation - Sandman    Jun 12, 2020 I'm still trying to wrap my head around the new and exciting feature B4XPages and I understand it's still not entirely finalized. However, I saw this limitation: One notable limitation is that in B4A, the activity that holds all the pages should be locked to a single orientation I was wondering if this is a limitation that might disappear once B4XPages evolves, perhaps even in the near... using B4XPages with locked orientation, if I could at least assume that the limitation would be removed... B4i Tutorial Monitor the device attitude (orientation) and acceleration with Motion object - Erel    Jan 12, 2015   (2 reactions) iPhone library v1.30 includes a new type named Motion. With this object you can monitor the device orientation and acceleration (similar to B4A PhoneSensors). The Motion object doesn't raise events. Instead you should use a timer to get the current values. 31112 The values returned from Motion.GetAttitude are measured in radians. The values returned from Motion.GetUserAcceleration are measured in G units (9.81 m / s^2).... Page: 1   2   3   4   5   6   7   |