I have a class with one method that tries to retrieve meta-data from the manifest. Everything works fine except that the bundle that I create from the application info returns null values
Here's the code:
private int getCurrentVersion(){
int currVersion = 0;
try {
ApplicationInfo app = context.getPackageManager().getApplicationInfo(context.getPackageName(),PackageManager.GET_META_DATA);
Bundle bundle = app.metaData;
for (String key: bundle.keySet())
{
Log.d ("TEST", key + " is a key in the bundle");
}
Log.d("TEST","google: "+bundle.getString("com.google.android.gms.version"));
Log.d("TEST","version: "+bundle.getString("dbVersion"));
//currVersion = Integer.valueOf(bundle.getString("dbVersion"));
currVersion = 1;
} catch (NameNotFoundException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
}
return currVersion;
}
03-05 18:53:23.818: D/TEST(31400): com.google.android.gms.version is a key in the bundle
03-05 18:53:23.818: D/TEST(31400): dbVersion is a key in the bundle
03-05 18:53:23.828: D/TEST(31400): google: null
03-05 18:53:23.828: D/TEST(31400): version: null
As you can see I'm using some logs to see if the bundle is empty, but its not.