Android Question B4A code for RxLogger that exposes intents for Zebra Technologies Mobile Computers

Hi,
I have recently dusted off my B4A development efforts but I am very rusty.

I am trying to use Zebra Technologies RxLogger Intent to start and stop the RxLogger app via B4A app. (see RxLogger guide https://techdocs.zebra.com/rxlogger/latest/guide/apis/).
This is the "intent" that is documented that will do one of the several actions the B4A app needs to perform, but no code sample was provided for any language:
'com.symbol.rxlogger.intent.action.ENABLE'

I am clearly missing something important, my code does not work properly, it actually launches the RxLogger but then suspends for the queue then hangs:
Log view shows:
  • ** Activity (main) Pause, UserClosed = false **
  • sending message to waiting queue (astreams_newdata)
I was hoping someone with more experience with B4A and Intents can provide more information or let me know what I am doing wrong. I know it can done. Once this one works, I will know what to do for the others. The solution will be able to help others trying to integrate with Zebra Technologies Mobile Computers.

B4A Code:
Public Sub setRxlStart () As Boolean
    Dim pm As PackageManager
    Dim intent As Intent

    intent = pm.GetApplicationIntent("com.symbol.rxlogger")
    If intent.IsInitialized Then
        Log("Starting RX Logger")
        intent.Action = "intent.action.ENABLE"
        StartActivity(intent)
        Return True
    End If
    Return False
End Sub
 
I was successful calling the intents. Since this project is a service with no UI, I decided not to go with B4XPages. I might going with them later.

For others interested, see the code below for one of the actions (ENABLE). There are several intent actions that follow the same code (DISABLE, BACKUP_NOW, ENABLE_STATUS).
B4A Code:
Public Sub setRxlStart () As String
    Dim currentTime As Long = DateTime.Now / 1000
    Dim action As String = "com.symbol.rxlogger.intent.action.ENABLE"
    Dim i As Intent
    Dim P As Phone
    Dim json As String = template
    json = json.Replace("$dateTime", currentTime)
    json = json.Replace("$command", "start")
    i.Initialize(action,"")
    i.SetComponent(action)
    Try
        P.SendBroadcastIntent(i)
        Log("RxLogger started")
        json = json.Replace("$status", "started")
    Catch
        Log("Error starting RxLogger. Is it installed?")
        json = json.Replace("$status", "failed")
    End Try
    Return json
End Sub
 
Upvote 0
Top