![]() |
Android / BroadcastListener / Zebra Scanner / DataWedge
Hallo ich versuche gerade in einer App den Intent von der DataWedge des ZEbra Scanners zu bekommen.
Dazu habe ich in meinem manifest
Code:
Mein code in Delphi sieht so aus
<intent-filter>
<action android:name="org.test.intent.barcode" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>
Code:
Im Datawegde von ZEbra habe ich
type
TDataWedgeDataEvent = procedure(Sender: TObject; const Data: string) of object; TDataWedgeBroadcastListener = class(TJavaLocal, JFMXBroadcastReceiverListener) private FReceiver: JBroadcastReceiver; FOnData: TDataWedgeDataEvent; public { JFMXBroadcastReceiverListener } procedure onReceive(context: JContext; intent: JIntent); cdecl; public constructor Create; destructor Destroy; override; property OnData: TDataWedgeDataEvent read FOnData write FOnData; end; constructor TDataWedgeBroadcastListener.Create; var LIntentFilter: JIntentFilter; begin inherited; FReceiver := TJFMXBroadcastReceiver.JavaClass.init(Self); LIntentFilter := TJIntentFilter.JavaClass.init; LIntentFilter.addAction(StringToJString('org.test.intent.barcode')); //LIntentFilter.addCategory(StringToJString('android.intent.category.DEFAULT')); TAndroidHelper.Context.registerReceiver(FReceiver, LIntentFilter); frTest.meDebug.Lines.Add('INIT OK'); end; destructor TDataWedgeBroadcastListener.Destroy; begin TAndroidHelper.Context.unregisterReceiver(FReceiver); inherited; end; procedure TDataWedgeBroadcastListener.onReceive(context: JContext; intent: JIntent); var data : string; begin frTest.meDebug.Lines.Add('onReceive'); data := JStringToString(intent.getStringExtra(StringToJString('com.symbol.datawedge.data_string'))); frTest.meDebug.Lines.Add('onReceive : "'+data+'"'); if (intent <> nil) and Assigned(FOnData) then FOnData(Self, data); end; var dw : TDataWedgeBroadcastListener; procedure TfrTest.Button4Click(Sender: TObject); begin dw := TDataWedgeBroadcastListener.Create; // end;
Code:
Hat da noch wer einen Tipp was da noch wo falsch sein könnte?
Profile Enabled
Associated Apps: "com.embarcadero.firemonkey.FMXNativeActivity | com.embarcadero.test" Barcode Input: Enabled Keystroke Output: Disabled Intent Output section: Intent action: org.test.intent.barcode Intent category: android.intent.category.DEFAULT (oder leer gelassen) Intent delivery: startActivity (bzw Broadcast intent) Component Information: [empty] In das onReceive geht er nie rein |
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:04 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz