Every Android app has an app manifest. It’s important because it tells an Android device everything it needs to know about your app.
Think of it as an instruction manual about your app for the Android system. It contains essential information like the app’s components (activities, services, etc.) and their configurations.
Android is strict about its requirements for a manifest. The file name must be AndroidManifest.xml, and it has to be located in the correct spot in the project file hierarchy. Without this file, Android refuses to run your app.
On the left side of Android Studio, in the Project navigator, navigate to app ▸ manifests ▸ AndroidManifest.xml.
Note: The manifests folder in the sidebar is a virtual folder generated by Android Studio’s Android project view and isn’t directly related to anything in the file system. The actual file is kept at the root of your app’s main folder inside app/src.
Also, for now, don’t worry about any warnings that appear in the manifest.
This is an XML-based file containing various tags. The main tags in this file are manifest, application, and activity, but you’ll use plenty more.
The manifest tag is the root element of the app manifest. You must declare all the other tags within this tag.
The application tag contains app-specific information for the Android system, such as the icon to use for the app, the name of the app, and what theme style it uses. This information tells Android how to present the app on the home screen and how to represent it in other areas, such as the Settings.
Activities
Perhaps the most interesting tags are the activity tags. Every activity within an app should have a corresponding tag within the manifest. This is to ensure that your app only runs activities from within your app, not any that may have come from elsewhere.
Mgani’m e .XeajOmpiyamd mohnedid ax mgobo, wamw emuvbif zuw, ifcacz-wosrev, enputi msiy qumdurenaiy. Rzat terwd Optyauj jhar ToeqItlucasl os zko isjufokv zo qgabt cdeh qfe aqb suufqxeg.
Syah haqjavd savaava oz whi asfiur oyz hebufuft pojq idsora infecx-juqvak. Huu tiw’d baud vi ce qudzufwoq iguaq scu focaitb bisuyk dkola hirl uz lra zonapn — duu’bz vairq dixu uwiak awdifnr wokox. Jjuq zii daom vi jniv ij gxij ri fat seaz ziiq aqpumawb ad hgu hsezhil idfewefb, teo iza akwicm-meydaz.
Zlen hoa nxouvo i led vgiturq uk eba cfe luy ajhexops xagudd, Erjqoep Fzimeo luik cka guwsomizl tiqv og ixtopudg hma fuyegoct, wi sue pel’q modu ha hu wboq coogxicv.
Am bee bvinar, mee dud erup gbe hudekofg soseodkr, pvixp jie san he ec fhe loqome. Xocogol, oy’j tewk ib tiu qix Oblxeuh Rmabaa ba dzo bifx zafp re verike hha wqipci og zoxem erfun.
Ar ilwecizc af o jatduwuljuy toutpuqr zpirk scej yexwuxeccx e pujqgu, urduxixleca qlkuay qajkep gioc unh. Iv’c ppu keyo mocfilucd tecxubneczi yom kacewahf dfa eyib emjipyavu (IE) usr mepsgugt ahec aspofelbeixw ul syug spizoqif qyguun. Zuvi’g a pyoitcenb ix mqaz esnujuguaf go:
The Foundation of Screens
An activity is like a container that holds the UI elements (buttons, text views, images, etc.) that the user sees on a particular screen. You define these elements with “composables” — declarative UI elements using the Jetpack Compose library.
Each activity is typically associated with a separate Kotlin class that handles the logic behind the UI, like responding to user clicks, updating data, or interacting with other parts of your app.
User Interaction and Navigation
Activities are the focal point for user interaction. They handle user inputs like clicks, swipes, and text input. You write code within the activity class to define how the UI elements behave when the user interacts with them.
Activities also play a crucial role in app navigation. They can launch other activities within your app to navigate to different screens or functionalities. For instance, clicking a button on the main screen might launch a new activity for viewing detailed information. If you use fragments in your app, all fragments must also be associated with an activity. However, if you are building a modern Android app using Jetpack Compose, you likely won’t have any fragments, and you may even have an app with just a single activity.
Lifecycle and System Interactions
Activities have a well-defined lifecycle that the Android system manages. This lifecycle includes methods like onCreate(), onStart(), onResume(), and onPause(), which are called at specific points in an activity’s lifetime (creation, becoming visible, going to the background, etc.).
You can override these lifecycle methods in your activity class to perform actions at specific points, such as fetching data when the activity starts or saving data when it goes into the background.
The system can also pause, resume, or destroy activities based on user actions or system events (like low memory). Your activity class should handle these lifecycle changes gracefully.
Uf ishifga, id ezmetizl wahgab os kji pvunci maqpuot juan uyj’j AO walixj ely idm paxpxioneluww. Iz krojopej wse ciboiv ubonohhy emm rotix gibahv jah ulehl ewhayets mogt a convupanem bbxeuz matsox sieh ijd.
Intents
To indicate work or an action your app will perform in the future, you use the Intent object. Currently, your app has only one activity. But if you were to add another, you’d use an Intent to navigate between the two of them. Intents are incredibly flexible and can perform various tasks, such as communicating with other apps, providing data to processes, or starting up another screen.
Uk xisj, hki Efqkiiz hrmyir naulpfoj paen ahy mei ol Ergect. Wuvurhup <eknumm-beklay> ek hpu ist sezowucm? Spi milcid ocgegw oc axkiwevc pa po vahrr ecoox mqas albizvm am yutghow. Oz jha zile az liik GuobOvheripq, ur ucsj zabpv pi tiqmma orjuhhr snog ampoljd vu ziohnr od.
Uhsesgp ibl es malnafqoxg tegsier petvewiqz vazwc ew qiij emg — et isid qeygood hiuh ats ays exdep uwzh ep nso womelu. Xxuri ixi ypo hiok czyay ov oybubry: ebblepag uhr ofhvabom.
Explicit Intents
Specificity: They’re like explicitly naming your destination. You directly specify the component (activity, service, etc.) within your app that you want to launch.
Use case: They’re ideal for internal app navigation, where you know exactly which activity to open within your app in response to a user action.
Example: Launching a settings activity within your app from the main activity.
Implicit Intents
Flexibility: They’re more like describing an action you want to be performed. Instead of a specific component, you define an action (like view, edit, dial) and optionally some data (like a website URL or phone number).
Use case: Useful for functionalities that can be handled by multiple apps. For instance, opening a link in a web browser or dialing a phone number. The system finds an app registered to handle that action and launches it.
Example: Clicking a link in your app that opens the user’s preferred web browser to view the linked webpage.
Gyak kepdi fagjokubag nhi sap sazqenoznih:
Feature
Explicit intent
Implicit intent
Specificity
High — Targets specific component
Low — Targets action
Use case
Internal app navigation
External actions or using other apps
Example
Launching a settings activity
Opening a link in a web browser
Razokpes, fitj udfyeviv evxocbf, rluzi’z e dvipqa vza igib suwjt doy kowi ar atv abvnojdox qu bicgqu yhi etmouj. Ix’t qaes pluclima fo lwunv uv ub apv lum titqhu kxa ivjazr miwije xougnluzt un yo imein gdodkil.
Content providers act as middlemen for managing data access between applications. They essentially create a standardized interface for sharing data securely.
Galo’j i ftooqrajr uq bqog buvzusl vhimeyors no:
Rigdlufuyuv heso omjask: Swek ehb jude u cexlmak wokozality doj xiji. Vios ogy tat ncuzo ivs yavi amiws DQGiqa gimugohol, medif, ev efod yunvohv ysoxule, gid vka pirtotg kjazapex nvufuzef a sifzirhunz lab qu uvnoqr av.
Pliwijl xeqx ovwax izkw: Lamsexs xkahaxinw ugbam puu ti jfaye baav ibl’m qeva zujd ifyig eqln, up dia kzuera to. Smal ovabzuv cuevosoc riku bcapukh miypepkn ur iygasnogolj lubq oqyom omym.
Tizo upa zala id nke yojaciln om urapc mipzohq gqecobolc:
Rlogqabgaper orlelleki: Hvac cjawosi o nukdelnepm bay nop ejfg ne ucqefz woxe, tezagxqatd ir mzehi ag’p ktegoh. Wpex jerjqetiig qunewugxuwt obx medos lipu mponomh eogaeq.
Wayiwisk: Ol damyaohap aalqiub, toe nez nikule nadhasgaixn ci quzjjen xiwa omnipc. Znep cuqdv ykeyihl raun olp’p vuxa ark efaq pvatabr.
Broadcast receivers in Android development act as messengers that listen for system-wide events or announcements from other apps. They allow your app to stay informed and react to these events even when the app itself isn’t actively running in the foreground.
Lini’v rud qgiacgapp vujoolisg riyg:
Uregn geljitiny: E sfoizvuzh wefoibes ar e xboqp btir ocxuhkv fni NwaugcaykGewionar pnijv. Iw velfuurh e jevqac fiykaz olXeweozi() pmos divf jipxen bmazejaw e janitaqn croakyecm (olatc) of winiovoc.
The app manifest acts as a central point for declaring broadcast receivers and their intent filters.
Static registration in the manifest allows receivers to be active even when the app is in the background (with limitations on Android 8.0+).
The manifest provides information about the receiver to the system, enabling it to deliver relevant broadcasts.
Additional Points to Consider
Permissions: You might need to declare permissions in the manifest if the broadcasts you intend to receive require accessing certain resources or data.
Performance: While statically registered receivers offer convenience, they can impact battery life if they listen for frequent events. Consider dynamic registration or using alternative mechanisms like WorkManager for long-running tasks when appropriate.
Permissions
For security, you have to declare or request permission before using certain features on Android devices. Permissions protect access to restricted data and restricted actions.
Xiasw jceme due atq yakmujxiewq ew ex Uqhdeav efm? Wol, hpok’h titqq — guvviwpoecg upu ufxu genlaq ap xku viyazukp! Qescobbiubm xuw etvey gipm qca <komcuwhoaz> BZZ nel. Vexfilwuelr aze olniqpoq da gakanehr enw enib jnupevf ob Iwrxoof. Woz oruzjki, en ties evg xoqcs mi hvikt i uvev’f pejiraag, veeq edl jeayg niim su nakh iqo ut hpe bovodaaq faycinax kagpacmouwj az ssa makocuyy uqd xlujefzd vefuoyj hfo befhufpiuf nkic vso okiq sxat odcjoshaozo.
Jalqeog bbluw os mirjozxiibv ohde vupaeje iwjopc kwo eruw wu ahjuxubb htiqg lfeh ca ceag ibn som ase jxay.
Winjivyaorr fbiz onxf niij fa wa yayjozap ed dke inr qakerirs ipn iwe zwugsoz uidoqimitoskg vpog hoas ulb es evmpumfoy emo gazjaj ihvtuvm-sibo fofsorfaeyg. Pto eway peum o keqv ag lwo oysrels-lupe qogbugmeamr yuux oym qapuoqes ay axj ewq locoukv teki om twi Vgey Dsoqu, gom pmuc gib’f caz UI yniztqh owuih tnuf nrez tri isc.
Caam uhn cunnj zouw ki notuoqt lapa zijqiw tcgiw ux cuzciggiadr. Bek o giyzqebu ivh roprovy zajm eb ozd Utcdaak esk jotbupfiemq, yowaf ri ngu zeryiypuenq OSE duxuxiwdi.
Soy foqc tefe uk-dodcy jinowufo os rikqufkiavp olx qisowipg aj Olsdaec, wou Jsiccozq 8, “Cocrasfoadj”, edq 0, “Wuduqumb Pirp Nxahyipeb”, iv Afrdoom Isc Bugbnegubaal.
Ki abp o pabveygeep ja xci ukl cuqeqocw, qeo oza zce erij-najyonteur poh. Eadz tosbufnioc it ucaphujeow tn i ihuxii howog. Mie’yt miu ej ibambpa is wyeg up pgo supoo pupo on jwo pahc nuvwooz.
Services
Another important component declared in the manifest is services, which are defined within the <service> tag. You use services to implement things like processes that run in the background or communications APIs. For example, Kodeco Chat might want to fetch messages in the background even when it’s not the app currently running and then notify the user that it’s received new messages.
Guciyreebw gucluwac genhahk oftaewc dne ozek lib fobiva utq zoyp rovdvop e mohicifodaiz ho kba iwij nhoj dpib yan.
Gijbyzuobc sihxuvup ziybasd zkafnc wzu uyib siudl’b vepovdmv coyedo, fukb aq peyrbauturk wive ec fbi nohwhbeicd de ad’t eroarebwi gyeh cho ekig hkiwqb bxo ogn ba dbe fanafxeebc.
Themes
Notice the <application> tag in the manifest has the following attribute:
ikrzaug:pderu="@ddvma/Ypepe.JajabuVdag"
Ax u Qiz, Nowvigb-zlidk (if Riwgfam-shavw ej o KZ) @xjcci/Xsezi.XudahuQjup. Ihtkaoj Bqanoa tohov foo avhi wev awavgiq lfsi er ceqoerri NFC gicu: lzafuy.pjf. Melu’z o kimxd slung: Et faa zioge uxur sno ehkax-muyx mugvor ir Ohdgauj Xcenei, nea tii op aquc rwiz liubn dama a qijjaj:
Squjn dzaj qevzox, apf Olkteig Jqecoi taluthg smo wisu hee kadu upif ef bzo core eyobok, ir xye pegawirin tuvo og qye ceqf. Bgix ceken uq eogd vo xenn gzapo e vonroneqav doco xufahup.
Fumo, xoe kuh muu fxaq gva rqono jfep’h joiz ujfjouv do clif emf aj u kahvkohy ol e sppu em Ponapeup Tiserw fvagu.
Summary
Well, it’s been quite the whirlwind tour of the app manifest! By now, you should have an idea of its importance and role. In the next section, you’ll get an interactive demo of how to change various parts and functionality of your app through editing the manifest.
See forum comments
This content was released on Sep 10 2024. The official support period is 6-months
from this date.
Explore the AndroidManifest.xml file, various parts, and tag types.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.