I can't really comment on the multicast issue, especially on Android. But if you are really doing multicasting, why are you using TIdUDPServer? That is not a multicast-enabled component. Indy has separate TIdIPMCastClient and TIdIPMCastServer components specifically for multicast.
For UDP, assuming a plain vanilla network broadcast is in fact, being used, are you setting up the TIdUDPServer.Bindings collection at all prior to activating the server?
One problem I do see is your use of TThread.Queue() captures the ABinding object, which is no longer valid once the TIdUDPServer is freed. Delphi anonymous procedures capture variables, not values. You should use TThread.Queue() more like this instead:
procedure TForm3.QueueLog(const AMsg: string);
begin
TThread.Queue(nil,
procedure
begin
Log(AMsg);
end
);
end;
procedure TForm3.QueueTestConnection(const APeerIP: string);
begin
TThread.Queue(nil,
procedure
begin
TestConnection(APeerIP);
end
);
end;
procedure TForm3.IdUDPServer1UDPRead(AThread: TIdUDPListenerThread;
const AData: TIdBytes; ABinding: TIdSocketHandle);
var
Data: string;
begin
Data := TEncoding.Default.GetString(AData);
QueueLog('Incoming broadcast message from: ' + ABinding.PeerIP);
if SameText(Data, 'mytriggerphrase') then
begin
QueueTestConnection(ABinding.PeerIP);
end;
end;