ApplicationInfo metadata returning null

I have the following code:

In the manifest:

<meta-data
    android:name="com.facebook.sdk.ApplicationId"
    android:value="@string/facebookApplicationId" />

In the code:

ApplicationInfo ai = getPackageManager().getApplicationInfo(
        getPackageName(), PackageManager.GET_META_DATA);
if (ai.metaData != null) {
   ...

But the result is ai.metaData==null. Why is this happening

Answers


From the latest android doc, <meta-data> can be only contained in <activity>/<activity-alias>/<service>/ <receiver>. So you should append meta-data in these components, not in <application> directly.


Need Your Help

XSLT - count the number of child elements by using XPath

xml xslt xpath count

I have the following XML file that stores movies and actors details:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.