Declare Google Api Key In Manifest (For Youtube API)
Using the maps API i can declare my key in manifest:
Solution 1:
You can use the existing meta-data or define a custom one in the AndroidManifest:
<meta-data android:name="com.my.app.myYoutubeID" android:value="AlOtOfNumBersAndLetters123" />
And use it at runtime (both for the dedicated or the existing meta-data):
String API_KEY = context.getPackageManager().getApplicationInfo(context.getPackageName(),PackageManager.GET_META_DATA).metaData.getString("com.my.app.myYoutubeID");
//String API_KEY = context.getPackageManager().getApplicationInfo(context.getPackageName(),PackageManager.GET_META_DATA).metaData.getString("com.google.android.maps.v2.API_KEY"); //this will use the Maps meta-data
youTubePlayerFragment.initialize(API_KEY, myOnInitializedListener);
Post a Comment for "Declare Google Api Key In Manifest (For Youtube API)"