简体   繁体   中英

How to get Application id(package + modulename) delphi XE5/XE6/XE7

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!

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM