Skip to main content

About the Android Manifest.xml File

 
  1. The main element is not surprisingly the manifest element.  It has attributes to specify :
    • Android namespace schema url ( “http://schemas.android.com/apk/res/android”)
    • Base package name for the android application. This serves two purposes:
      • Uniquely identifies the application on a device.   Your website url would be a good choice. eg:  yourwebsite.com.package.suffix
      • Acts as a shortcut for dot (“.”) that can used to specify  the class names elsewhere in the manifest file. For eg, “.MainActivity” instead of com.example.MainActivity in the example shown here.
    • Android manifest version code is an integer that is used to identify the version of your application. Newer versions are expected to have a higher version code than the older ones and is  used in deciding whether to update your application with a new version.
  1. The minsdkversion element indicates the minimum api level supported by your android application. For example if  you are using the apis  that are only supported  in the latest android version ( say icecream sandwitch) , you specify the minsdkversion as “15″. This prevents your application from being installed on a old device that doesn’t support the latest apis. You can also explicitly specify the targetsdkversion.

  2. The <application> is the main element in the manifest file that describes your application components and their intents. Among its many attributes in the android manifest file is the debuggable attribute which needs to be true if you want to support debugging the application on an actual device rather than in a emulator.
  3. Activities are  the UI screens through which the user interacts with your application and intents are abstractions describing the operation that can be performed on the android components. You can use the android manifest activity element to list all the activities in your application along with their  intents.  In this example, we specify the com.example.MainActivity  as the MAIN  intent  for the application and assign it a LAUNCHER category which tells the android system to launch this screen when the user open your application for the first time.
  4. Android manifest service are long running background task that do not have any UI.  They are useful for keeping something running regardless of whether its being rendered on the screen. The typical example is a keeping the music running in the background while you check the  weather using the weather app. The <service> element is used to list the services in your application.
  5. Broadcast receivers are pieces of logic that respond to various  events/intent that occur in the system.  For example,  when an SMS is received, an event is  broadcast by the system. All the receivers receive the event, but only the receiver responsible for handling the SMS actually does something with it. You can use the <receiver>element  to specify the list of  receivers in your application.
  6. <provider> element is  used for specifying the content providers.  The android manifest provider elements refer to components that provide a seamless interface for creating and accessing shared  data.  For example, the android system shares the contact information as a content provider that you can then make use of in your application using the content provider apis.


Comments

Popular posts from this blog

Fragment: App loads with white screen for 3 secs before showing proper UI

Issue: 1) When my application start then white/black screen appears, and then main UI is display.  2) Before my fragment load in activity black/white screen appears for 3/4 seconds and then fragment load. Solution: To fix this nasty problem, update the /res/values/styles.xml to include <item name="android:windowDisablePreview">true</item> or <item name="android:windowBackground">@android:color/black</item> for example : <!-- Application theme. -->  <style name="AppTheme" parent="AppBaseTheme">  <!-- All customizations that are NOT specific to a particular API-level can go here. -->  <item name="android:windowDisablePreview">true</item>  <!-- <item name="android:windowBackground">@android:color/black</item> -->  </style>

Android: The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

Solution Try the following any one solution and problem will go away: 1)  Apply following steps: Close the project and reopen it. Clean the project (It will rebuild the buildpath hence reconfiguring with the JDK libraries) OR Delete and Re-import the project and if necessary do the above steps again. 2)  Apply following steps: Go to properties of project with the build error (right click > Properties) View the "Libraries" tab in the "Build Path" section Find the "JRE System Library" in the list (if this is missing then this error message is not an eclipse bug but a mis-configured project) Remove the "JRE System Library" Hit "Add Library ...", Select "JRE System Library" and add the appropriate JRE for the project (eg. 'Workspace default JRE') Hit "Finish" in the library selection and "OK" in the project properties and then wait for the re-build of the project Hopefully th

Error: Retrieving parent for item: No resource found that matches the given name after upgrading to AppCompat v23

My project is going on easily but suddenly what I found below bugs when developing an app. I know it's minor bug but it may be useful to anyone. Here is the error: Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. Solution: This happens because after updates your android studio uses API 23 by default. 1) First check that your compile SDK version must match the support library's major version. If you are using version 23 of the support library, you need to compile against version 23 of the Android SDK. Alternatively you can continue compiling against version 22 of the Android SDK by switching to the latest support library v22.   2) Go to your project structure -> Properties -> and change Build tool version to