What exactly do I need a tag in the manifest? I realized that for some additional data. But is it possible in more detail? It is desirable to give an example.

    3 answers 3

    The element defines a name-value pair for an element of additional arbitrary data that can be supplied with the parent component. The constituent element may contain any number of elements. Use a name / value pair to work with some API, for example, to use Google Play services, you need to register tags:

    <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.company" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true"> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/> <activity android:label="@string/app_name" android:name="BannerExample"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> </manifest> 

      meta-data used to navigate through the back stack.

        <activity android:name=".MainActivity"> </activity> <activity android:name=".ChildActivity"> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".MainActivity" /> </activity> 

      And, for example, in the button handler back on the actionbar (android.R.id.home):

       if (NavUtils.getParentActivityName(getActivity()) != null) { NavUtils.navigateUpFromSameTask(getActivity()); } 

      So navigation will be in accordance with the recommendations of Google .

        Read here: http://blog.iangclifton.com/2010/10/08/using-meta-data-in-an-androidmanifest/

        In particular, it can be used to store data that may be necessary for each activity in the application.

        This is especially useful for things like API keys.

        • one
          The link is good, but could you add in the examples in the answer, so that it would be self-sufficient, for example, in case the link dies? - anber