#AdditionalJar: sdk-v1.0.0.jar
#AdditionalJar: spenremote-v1.0.1.jar
Sub Process_Globals
    Private SpenRemote As JavaObject
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
    SpenRemote = SpenRemote.InitializeStatic("com.samsung.android.sdk.penremote.SpenRemote").RunMethod("getInstance", Null)
    Log($"Air motion: ${SpenRemote.RunMethod("isFeatureEnabled", Array(1))}"$)
    Log($"Button: ${SpenRemote.RunMethod("isFeatureEnabled", Array(0))}"$)
    Dim Callback As Object = SpenRemote.CreateEventFromUI("com.samsung.android.sdk.penremote.SpenRemote$ConnectionResultCallback", "Connection", Null)
    Dim ctxt As JavaObject
    ctxt.InitializeContext
    If SpenRemote.RunMethod("isConnected", Null) = False Then
        SpenRemote.RunMethod("connect", Array(ctxt, Callback))
    End If
End Sub
Sub Connection_Event (MethodName As String, Args() As Object) As Object
    Log(MethodName)
    Return Null
End Sub