When the user runs the app for the first time, show a dialog asking for the preferred orientation and then set it using SetScreenOrientation (Phone library), you can save their choice in a INI file or something which will be read the next time the app runs and set the orientation accordingly.
use can use Preferences, (see this) this library allows you to create the "standard" settings screen:
Create Preferences screen:
B4X:
Dim screen As PreferenceScreen
screen.Initialize("Settings", "")
Dim catGeneral As PreferenceCategory
catGeneral.AddList("LockScreenOrientationMode", "Lock the screen in portrait or landscape mode", "Select to Lock the screen in portrait or landscape mode", "Auto (Unlocked)", _
Array As String("Auto (Unlocked)", "Portrait", "Landscape", "Reversed Portrait", "Reversed Landscape"))
screen.AddPreferenceCategory(catGeneral)
read preferences where you want:
B4X:
Dim manager As PreferenceManager
Dim setting_LockScreenOrientationMode As Int
....
Try
Select manager.GetString("LockScreenOrientationMode")
Case "Auto (Unlocked)"
setting_LockScreenOrientationMode = -1
Case "Landscape"
setting_LockScreenOrientationMode = 0
Case "Portrait"
setting_LockScreenOrientationMode = 1
Case "Reversed Landscape"
setting_LockScreenOrientationMode = 8
Case "Reversed Portrait"
setting_LockScreenOrientationMode = 9
End Select
Catch
setting_LockScreenOrientationMode=-1
End Try
then you can set orientation in activity_create:
B4X:
Sub Activity_Create(FirstTime As Boolean)
Dim phone1 As Phone
phone1.SetScreenOrientation (setting_LockScreenOrientationMode)
....