Android Question Help: My B4A app is not receiving DataWedge intents on Android 13

fabton1963

Member
Licensed User
Longtime User
Hi everyone,
I’m having trouble getting my B4A app to receive intents sent from DataWedge (or via adb broadcast) on Android 13.
Here’s my manifest

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="35"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
'End of default text.

' Receiver export (ok anche su Android 11)
SetReceiverAttribute(zebrareceiver, android:exported, "true")

' Filtro per DataWedge: action DEVE combaciare con il profilo
AddReceiverText(zebrareceiver,
<intent-filter>
    <action android:name="com.elmac.DTWEDGE" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>
)

Starter service
B4X:
Sub Process_Globals
    Public PendingScans As List
End Sub

Sub Service_Create
    PendingScans.Initialize
End Sub

Public Sub OnScanFromDW(code As String)
    If SubExists(B4XPages.MainPage, "read_item_barcode") Then
        CallSubDelayed2(B4XPages.MainPage, "read_item_barcode", code)
    Else
        PendingScans.Add(code)
    End If
End Sub
zebrareceiver.bas
B4X:
Sub Receiver_Receive (Intent As Intent)
    Log("DW action: " & Intent.Action)
    Log("DW extras: " & Intent.ExtrasToString)

    Dim code As String
    If Intent.HasExtra("com.symbol.datawedge.data_string") Then
        code = Intent.GetExtra("com.symbol.datawedge.data_string")
    Else If Intent.HasExtra("com.motorolasolutions.emdk.datawedge.data_string") Then
        code = Intent.GetExtra("com.motorolasolutions.emdk.datawedge.data_string")
    Else
        Return
    End If

    CallSubDelayed2(Starter, "OnScanFromDW", code)
End Sub

What happens


I’ve confirmed that my app’s receiver is correctly listed when I run:
adb shell cmd package dump com.elmac.zebrascan
and it shows:

Receiver Resolver Table:
Action: "com.elmac.DTWEDGE"
Category: "android.intent.category.DEFAULT"

However, when I send this broadcast:

adb shell am broadcast -a com.elmac.DTWEDGE -c android.intent.category.DEFAULT --es com.symbol.datawedge.data_string "TEST123"

nothing happens — my Receiver_Receive sub never fires and no log messages appear.


My questions​


  1. Is there something I’m missing in the manifest for implicit broadcasts on Android 13+?
  2. Do I need to register the receiver dynamically (e.g., via BroadcastReceiver.Initialize in a service) instead of statically in the manifest?
  3. Has anyone successfully received DataWedge broadcasts with B4A targeting SDK 33+?

Any help, sample project, or working manifest would be greatly appreciated

Thanks in advance!
— Fabrizio Toniolo
 

Attachments

  • zebrascan.zip
    10.7 KB · Views: 3

fabton1963

Member
Licensed User
Longtime User
Enabling component information in datawege app

Something happens:
java.lang.Exception: Sub receiver_receive signature does not match expected signature.

public static anywheresoftware.b4a.pc.RemoteObject com.elmac.zebrascan.zebrareceiver_subs_0._receiver_receive(anywheresoftware.b4a.pc.RemoteObject) throws java.lang.Exception
class anywheresoftware.b4a.pc.RemoteObject, class anywheresoftware.b4a.pc.RemoteObject,
 
Upvote 0

fabton1963

Member
Licensed User
Longtime User
SOLVED:

B4X:
Private Sub Receiver_Receive [B](FirstTime As Boolean, StartingIntent As Intent)[/B]
    Log("DW action: " & StartingIntent.Action)
    Log("DW extras: " & StartingIntent.ExtrasToString)

    Dim code As String
    If StartingIntent.HasExtra("com.symbol.datawedge.data_string") Then
        code = StartingIntent.GetExtra("com.symbol.datawedge.data_string")
    Else If StartingIntent.HasExtra("com.motorolasolutions.emdk.datawedge.data_string") Then
        code = StartingIntent.GetExtra("com.motorolasolutions.emdk.datawedge.data_string")
    Else
        Return
    End If

    ' Non dare per scontato che Starter sia già attivo:
    CallSubDelayed2(Starter, "OnScanFromDW", code)
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…