In AndroidManifest.xmlMeta data defined in AndroidManifest.xml can be retrieved with some codes like this: try { ApplicationInfo ai = getPackageManager().getApplicationInfo(activity.getPackageName(), PackageManager.GET_META_DATA); Bundle bundle = ai.metaData; String myApiKey = bundle.getString("com.myapp.version.api.key"); } catch (NameNotFoundException e) { Log.e(TAG, "Failed to load meta data : " + e.getMessage()); } catch (NullPointerException e) { Log.e(TAG, "Failed to load meta data : " + e.getMessage()); }
댓글 없음:
댓글 쓰기