title: Delphi 10.3 Android Intent BroadcastReceiver
body: <p>I have a ZEBRA TC20, I have configured DataWedge according to this Guide:</p>
  
  <p><a href="https://techdocs.zebra.com/datawedge/6-6/guide/api/tutorials/" rel="nofollow noreferrer">https://techdocs.zebra.com/datawedge/6-6/guide/api/tutorials/</a> </p>
  
  <p>The only difference I made is Intent Action: <code>com.xlr.ACTION</code></p>
  
  <p>In Delphi, I have the following Unit to process this (found the example from Embarcadero):</p>
  
  <pre class="lang-pascal prettyprint-override"><code>unit uScanner;
  
  interface
  
  uses
    System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, System.Messaging, FMX.Platform,
    FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, Androidapi.JNI.GraphicsContentViewText,
    FMX.Controls.Presentation, FMX.StdCtrls, FMX.Layouts, FMX.WebBrowser, FMX.Objects, FMX.ScrollBox, FMX.Memo;
  
  
  
  type
    TScanner = class(TForm)
      Memo1: TMemo;
      Label1: TLabel;
      procedure FormClose(Sender: TObject; var Action: TCloseAction);
      procedure FormCreate(Sender: TObject);
    private
      { Private declarations }
      function HandleAppEvent(AAppEvent: TApplicationEvent; Acontext: TObject) : Boolean;
      procedure HandleActivityMessage(const Sender: TObject; const M: TMessage);
      function HandleIntentAction(const Data: JIntent): Boolean;
    public
      { Public declarations }
    end;
  
  var
    Scanner: TScanner;
  
  implementation
  
  {$R *.fmx}
  
  uses FMX.Platform.Android, Androidapi.JNI.JavaTypes, Androidapi.JNI.Net, Androidapi.JNI.Os, Androidapi.Helpers;
  
  procedure TScanner.FormClose(Sender: TObject; var Action: TCloseAction);
  begin
    Action := TCloseAction.caFree;
  end;
  
  procedure TScanner.FormCreate(Sender: TObject);
  var
    AppEventService : IFMXApplicationEventService;
  begin
    if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService, AppEventService) then
      AppEventService.SetApplicationEventHandler(HandleAppEvent);
  
    MainActivity.registerIntentAction(StringToJString('com.xlr.ACTION'));
  
    TMessageManager.DefaultManager.SubscribeToMessage(TMessageReceivedNotification, HandleActivityMessage);
  end;
  
  procedure TScanner.HandleActivityMessage(const Sender: TObject; const M: TMessageBase);
  begin
    if M is TMessageReceivedNotification then
      HandleIntentAction(TMessageReceivedNotification(M).Value);
  end;
  
  function TScanner.HandleAppEvent(AAppEvent: TApplicationEvent; Acontext: TObject): Boolean;
  var
    StartupIntent: JIntent;
  begin
    Result := False;
    if AAppEvent = TApplicationEvent.BecameActive then
    begin
      StartupIntent := MainActivity.getIntent;
      if StartupIntent &lt;&gt; nil then
        HandleIntentACtion(StartupIntent);
    end;
  end;
  
  function TScanner.HandleIntentAction(const Data: JIntent): Boolean;
  var
    Extras: JBundle;
  begin
    Result := False;
    if Data &lt;&gt; nil then
    begin
      Extras := Data.getExtras;
      if Extras &lt;&gt; nil then
        Label1.Text:=JStringToString(Extras.GetString(StringToJString('com.symbol.datawedge.data_string')));
    end;
  end;
  
  end.
  </code></pre>
  
  <p>I have also altered <code>AndroidManifest.template.xml</code>, it looks like this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!-- BEGIN_INCLUDE(manifest) --&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="%package%"
          android:versionCode="%versionCode%"
          android:versionName="%versionName%"
          android:installLocation="%installLocation%"&gt;
  
      &lt;uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="%targetSdkVersion%" /&gt;
      &lt;%uses-permission%&gt;
      &lt;uses-feature android:glEsVersion="0x00020000" android:required="True"/&gt;
      &lt;application android:persistent="%persistent%" 
          android:restoreAnyVersion="%restoreAnyVersion%" 
          android:label="%label%" 
          android:debuggable="%debuggable%" 
          android:largeHeap="%largeHeap%"
          android:icon="%icon%"
          android:theme="%theme%"
          android:hardwareAccelerated="%hardwareAccelerated%"
          android:resizeableActivity="false"&gt;
  
          &lt;%provider%&gt;
          &lt;%application-meta-data%&gt;
          &lt;%uses-libraries%&gt;
          &lt;%services%&gt;
          &lt;!-- Our activity is a subclass of the built-in NativeActivity framework class.
               This will take care of integrating with our NDK code. --&gt;
          &lt;activity android:name="com.embarcadero.firemonkey.FMXNativeActivity"
                  android:label="%activityLabel%"
                  android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
                  android:launchMode="singleTask"&gt;
              &lt;!-- Tell NativeActivity the name of our .so --&gt;
              &lt;meta-data android:name="android.app.lib_name"
                  android:value="%libNameValue%" /&gt;
              &lt;intent-filter&gt;  
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt; 
              &lt;intent-filter&gt;  
                  &lt;action android:name="com.xlr.ACTION" /&gt;
                  &lt;category android:name="" /&gt;
              &lt;/intent-filter&gt; 
          &lt;/activity&gt;
          &lt;%activity%&gt;
          &lt;%receivers%&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  &lt;!-- END_INCLUDE(manifest) --&gt;
  </code></pre>
  
  <p>I have launched the app in Debug mode, and set a breakpoint at <code>HandleActivityMessage</code>, but nothing happens.</p>
  
  <p>Can someone please help me out a bit here?</p>