unit uDeviceID;
interface
Uses
FMX.
platform,
{$IFDEF ANDROID}
fmx.helpers.android, androidapi.JNI.GraphicsContentViewText, androidapi.jni.JavaTypes,
androidapi.helpers,androidapi.jni.App, androidapi.jni.Net, androidapi.JNIBridge,
{$ENDIF}
classes, Types, FMX.types, system.Messaging;
type
TDeviceIdentifier =
class(TComponent)
private
{$IFDEF ANDROID}
WifiManagerObj: JObject;
WifiManager: JWifiManager;
WifiInfo: JWifiInfo;
{$ENDIF}
FWifiMacAdresse:
String;
public
Constructor Create(aOwner:TComponent);
end;
implementation
{ TDeviceIdentifier }
constructor TDeviceIdentifier.Create(aOwner: TComponent);
begin
inherited;
{$IFDEF ANDROID}
WifiManagerObj := SharedActivityContext.getSystemService(TJContext.JavaClass.WIFI_SERVICE);
WifiManager := TJWifiManager.Wrap((WifiManagerObj
as ILocalObject).GetObjectID);
WifiInfo := WifiManager.getConnectionInfo();
FWifiMacAdresse := JStringToString(WifiInfo.getMacAddress);
{$ENDIF}
end;
end.