String () { if (ApplicationManager.getApplication().isUnitTestMode()) { return null; } String appId; final ID nativePool = Foundation.invoke("NSAutoreleasePool", "new"); try { final ID bundle = Foundation.invoke("NSBundle", "mainBundle"); final ID dict = Foundation.invoke(bundle, "infoDictionary"); final ID nsAppID = Foundation.invoke(dict, "objectForKey:", Foundation.nsString("CFBundleIdentifier")); appId = Foundation.toStringViaUTF8(nsAppID); } finally { Foundation.invoke(nativePool, "release"); } if (appId == null || appId.isEmpty()) { LOG.error("can't obtain application id from NSBundle.mainBundle"); } return appId; }