On Android 6 it works, on Android 11 it doesn't
I am trying this code to display compass, pitch and roll directions
Loaded on phone with Android 6 it works fine
If I try to load on the Eda52 terminal that is equipped with Android 11 as standard, it does not work in the sense that the triple of values rsults always zero
What can it depend on?
Library: Animation, Core, Phone
B4A: ver 11.80 (64 bit)
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			I am trying this code to display compass, pitch and roll directions
Loaded on phone with Android 6 it works fine
If I try to load on the Eda52 terminal that is equipped with Android 11 as standard, it does not work in the sense that the triple of values rsults always zero
What can it depend on?
Library: Animation, Core, Phone
B4A: ver 11.80 (64 bit)
			
				Main code:
			
		
		
		#Region  Project Attributes
    #ApplicationLabel: COMPASS TEST 2
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
    #BridgeLogger:true 
#End Region
#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region
Sub Process_Globals
    Dim Orientation As PhoneOrientation
    Dim tmrUpdater As Timer
End Sub
Sub Globals
    Dim pnlRose As Panel
    Dim pnlNeedle As Panel
    Dim Rotation As Animation
    Dim dblAngle As Double
    Dim dblPitch As Double
    Dim dblRoll As Double
  
    Private lblGradi As Label
    Private lblGradi2 As Label
    Private lblGradi3 As Label
    Private lblPitch As Label
    Private lblRoll As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Compass")
    pnlRose.SetBackgroundImage(LoadBitmapSample(File.DirAssets, "compass.png", pnlRose.Width, pnlRose.Width))
    pnlNeedle.SetBackgroundImage(LoadBitmapSample(File.DirAssets, "needle.png", pnlRose.Width/9.6, pnlRose.Width))
    Rotation.InitializeRotateCenter("Animation", dblAngle, dblAngle, pnlNeedle)
    Rotation.Duration = 20000
    tmrUpdater.Initialize("tmrUpdater",500)
    Orientation.StartListening("Orientation")
    tmrUpdater.Enabled = True
End Sub
Sub Orientation_OrientationChanged (Azimuth As Float, Pitch As Float, Roll As Float)
    dblAngle = -Azimuth
    dblPitch=Pitch
    dblRoll=Roll
End Sub
Sub tmrUpdater_Tick
    Log("Angolo = " & dblAngle & "  Pitch=" & dblPitch & "  Roll=" & dblRoll)
    Rotation.InitializeRotateCenter("Animation", dblAngle, dblAngle, pnlNeedle)
    Rotation.Duration = 20000
    Rotation.Start(pnlNeedle)
  
    lblGradi.Text=dblAngle
    lblGradi2.Text=NumberFormat2(dblAngle, 3, 2, 2, False)
    lblGradi3.Text=NumberFormat2(dblAngle,3, 0, 2, False)
    lblPitch.Text=NumberFormat2(dblPitch,2, 2, 2, False)
    lblRoll.Text=NumberFormat2(dblRoll,2, 2, 2, False)
End Sub
			
				Log windows:
			
		
		
		Logger connesso a:  Honeywell EDA52
--------- beginning of main
** Activity (main) Pause, UserClosed = false **
--------- beginning of crash
anywheresoftware.b4a.B4AUncaughtException
    at anywheresoftware.b4a.Msgbox.debugWait(Msgbox.java:210)
    at anywheresoftware.b4a.debug.Debug.wait(Debug.java:217)
    at anywheresoftware.b4a.debug.Debug.StartFromShell(Debug.java:109)
    at anywheresoftware.b4a.shell.Shell.start(Shell.java:101)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:94)
    at aaa.compass2.logicd.main.afterFirstLayout(main.java:97)
    at aaa.compass2.logicd.main.access$000(main.java:17)
    at aaa.compass2.logicd.main$WaitForLayout.run(main.java:83)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7697)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
Copying updated assets files (3)
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Angolo = 0  Pitch=0  Roll=0
Angolo = 0  Pitch=0  Roll=0
Angolo = 0  Pitch=0  Roll=0
Angolo = 0  Pitch=0  Roll=0
Angolo = 0  Pitch=0  Roll=0
Angolo = 0  Pitch=0  Roll=0
Angolo = 0  Pitch=0  Roll=0
Angolo = 0  Pitch=0  Roll=0
Angolo = 0  Pitch=0  Roll=0
Angolo = 0  Pitch=0  Roll=0
Angolo = 0  Pitch=0  Roll=0
			
				Last edited: