Ad

How To Get Application Id(package + Modulename) Delphi XE5/XE6/XE7

- 1 answer

Is there a way to get the application id in runtime for Android and iOS in delphi XE7?

For android you can see the application id at: project options -> version info(Target Android) -> package and for iOS: project options -> version info(Target iOS) -> CFBundleName

Thanks in advance!

Ad

Answer

Reading Android package name:

uses
  Androidapi.Helpers;

function PackageName: string;
begin
  Result := JStringToString(SharedActivityContext.getPackageName);
end;

Reading iOS bundle name:

uses
  Macapi.CoreFoundation, iOSApi.Foundation;

function PackageName: string;
begin
  Result := TNSString.Wrap(CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle, kCFBundleIdentifierKey)).UTF8String;
end;
Ad
source: stackoverflow.com
Ad