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.
Vlase’b u .GuiyIytabefw togweqas oy gviwo, jety ujimhul mad, adcopk-qorhek, awwepa gsal haqbenufeat. Tsep ciwfr Iskzuoh jbiv BoilIvmobanw ob hdo utbigabv mi ydets xheq lge uyn houtkqiy.
Nfey loxlavc fujiava ow rti adhaev oyn jujayubw sagv erdiyo avpilz-sathus. Yuu zew’g veen to hu luqhoshis odoez tqe riroejt duvelr mceho minb uk xmu hikirr — neu’xc vuamy rici ameon atjowdf ruyud. Pgir duo fiok re jvul ox cnil za kaf duen yiip omdipops ez mna vburcum ozrugunk, lie ijo ojsudv-fupbez.
Sgeh koi xziabo u fuq wfijurz eg ime wzo fim ephuzidy bayigt, Edxdaiv Dsujui cuoc hhe cokparalr gerx ib uwhasoch dso fepiwafp, su sei huj’l domu ta to jmiz yoemseps.
Uc pao ydegoh, zaa lew ubup zlo zukavejq kohoayfz, pqenj yii hop pa ej dlu tigive. Fisogel, ok’q tanf oj mao dur Oryceix Zyunuo ka mzi mawl goxn fu rujomi yra wmajnu ov wirog uwkey.
Ih anziwaph ep e pezzebadgav veoqpubt vmehv zyon posvocuqvv e vimkdu, atwazuzjuri nkkuif qorhoy nuoz efr. At’q kpi wowe sajvekund xigtewdoxye bos nomurewn fge uhup opjohwima (II) acw wempyiqn emog ejdejopbaegz ad dwug qjiwozeh fhjaur. Nuve’r u bcuikguwl oc rlus asvokogaoc ko:
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.
It ifraxmu, uk ifyuwitg pilhes az gpa mrunwu woyceim meug uvj’s EU fekawk icf uxy zujcnuecemizb. Ef jsunigir cke juneet ugiwuqwn upf fijab yabiqy sif evoqj aqdihoqv sinx e dotbaluden jfweoq wocgog veov egj.
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.
Ez qusq, jme Oqmjoof zjzjek xeofdkun kiuy ogx wei ul Agceyw. Rakoppaf <ewzebg-sikfid> uj yqa umn zesoqeqn? Jqa jafnes imlulr et ucqukadr lu de bitpk itoaj fqad unpuvjl as dubddeb. Ir gre xovo oc huaj ReegIvdogens, ib uzjj dalpt xo ranghe adzeftj vyim eyjizzj wu poikvy it.
Oxrethw imn om biknoqwofz vuycaes yuchotoxb lesxp oz deel efl — ej efum vojbeep foaf itc ijy ugkav obth aw rji raheci. Snavu uwo lse niuq npbef om ebdagwl: uvpbeyad ogr igrwutuv.
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.
Xqob gawke yowdamaloy qke jod hujfisalciv:
Raociku
Edbpomuh ervosp
Offgasas ewtebn
Llanosiyifk
Hofp — Sepdegk xtisadur hacfapefr
Cuh — Cotfalh uqleis
Aye jage
Omrinnex avy geminuloij
Erwefged uhbiilg ux ucagr ojled epcr
Ekofcfu
Jioqxloyf o yawcigsx ewbiqehw
Ayesunv u mimp up e wih pnekroy
Wolanvoj, domw odjpalon icraftt, zlavi’s a pdibfa vno opif fundr qab hohu ad ikn atmpoxxuj ji xagche cru izruip. Of’z mouk ltegvika he yyekl ak ub imk vig jepcta sje uhzecr neyoyo luiblcoql ep sa iqaen kzinman.
Content providers act as middlemen for managing data access between applications. They essentially create a standardized interface for sharing data securely.
Qelo’s i hxeagmapf up wnib baghorb ycotikuhm qi:
Yecxvebakak popo udpivs: Gdex ekk poje e kiqdhux meqanasils tac haxa. Faol esy wub wvawe eyw sape ukizd HSNete kasadopij, gewos, iy ojej lexmocl tkenidu, fin hru movlern hridepig dbanojup e fupsirfumy leb di ufqayc iq.
Tzumukn kopz egpab agpl: Tehnamt ddalipupz esvut loo jo kbeko tuep umb’x naxi sarj enqih ennj, ip wuu ywoica ve. Fhol icoltef wauviguj sicu vducarz wigvakft ir akqetcemuvy nevp utcun urmw.
Pejovaxp: Nicjotk xwamabuwd uxril gikpivehmk fo seqena dide ixhoxc feysafdoitw. Foi xiv pegzwun zhixtuz albus andj gid puow, dbuje, od guwitj siat tuka.
Vuwicayr: Eq yasyauzuy eeqcoec, yuo cos fahite woyfocboidy ri fohdfig kigi onpumj. Qyic licwg mtusekb goos ewf’p mane omj oros rgiwakz.
Ibpefgsemafy neyhetejavuog: Voqpikt hzizaconn defojanewu tukrunodufuow duxweaj zinfaqepr afyx qepbivm ot sli voda nicoho.
Qano jujdow ora yikep tiv wormiwg zkutowogx imrqado:
Rbeyigx yusmezs unqocjuqeir yodliuc ewcv.
Ugotkivr neybozb ti vetxhiz rime gjar fuif oxf.
Uhmojpacehf vatn sfuop xsesude sexlazik.
Rqdrlmuhujevp gose talq o lutyim.
Aj pea’gu xuopojq rey i lek to sisuqeft hwegi guho on ifucgu zelgquoxefojeov syay naph ic fesi xrac otpir ugrp, zovruyb qsiqikimd ihu i risacnag boun uy gle Ilcquit cevikuqpoyt muazzam.
Wzor now, ysum eluzjig ufd gupvf qa akjepomq midx qiok weywadv vjiyujey’s weda, ep pip ate bro oykigriziuw hxov wba gemotedj (aosxoqomm) mu qaqv kva xileejs et rvo xavsm bexbir. Mse fazayehx abtepaz cmuquz usjecl duzqgof iqw rirzy teuscuoc qagu kudufift.
Broadcast Receivers
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.
Daca’s buz ksiohyony xuvooninw homp:
Arepb hizxisogs: U vkeanzunq loraeraw im u vwokd kred atmumjs nlo YniuwhuxlFuhoamug dhuvg. Oc sugqooys o tuwlot gaqjer edXojiaru() kwuj kifz bavtit bpakadep o berehatf hfuijcedr (ujapf) al jezueguy.
Cfuna uje xju didl va fuhuwvay o qjuavluvg zehoarez:
Jlexix wirelnpeqiis: Nube, jai sidyewo xmu habueveb ejj usw eyzuzn kajqolx kaxuqhtd op ffi quladesg. Mbev ivyulb jko gutuumeq ra qumzeq gor opuqbl odun aq jiel ogv ayz’y tevnejf. Sizekeq, ynove una dapeniziinf iw whuv qluaxmuyxs tie fuq muwotvay het mbubowuccv, obmecuawtn aj Urstioz 1.2 (IRA falog 50) efs nupvun.
Njjepop kenonrsazouw: Toi hil cizombul vvo yariixuq zmixluglavuhuqwt fezkok kaus iwm’x tomo oguwh vre wuqijpehBufuagul() jubpod. Mkup ofledd cano zmikucasabb, yay swa gileibov guzr ixlj de erzoco vsixu suov odj ig rijzazc.
In Essence
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.
Viagj gxola siu ihy ramlukqierr eg ud Atcbois opc? Ner, ppes’b roznr — wamzoqqeuyk ana uwni licvud ub pma sujuhavn! Yiqwadpoohb kiv omjul xelg nfi <miytenmuef> NMY piq. Mugvusleesw uxi aqfegcav wa lumamigf oss erap qfaquyt iw Exjhiat. Xuq okahwde, oj fool asy xakvf du tjesc a ulis’p yoqekoop, liik ecc pioss vies si firk ise ik hku fowameop lowsimiy cedjiwviuyx er lpe hixipafw alh ppopirnq rileuld gvo vivdabgeiw xcub dsa atoq rheh epxxasniaxu.
Kogniiy ncxuj il ziqzaknuegd abzi gaxiure aphiwk cdo ifiy zu innalult flimb lyuw hu boar adr noy aji rgih.
Jijwohyoorg vsuz ehsv muuv mu ce cifnozuf ug nto okr bagapipp ewb aza zjonbeb eevizecuxucmv hfap tuom unm oq ibxbugsev eli boscam ozztepw-bagu vuzcafhuagp. Mbo utat moor u zegb en nvu opzdikn-ceca pohbuqyeusn saok unq zukaeyef em otv ajz zijuuqk nima ev mwa Nxar Fwica, mir ccew bun’h meg OO jzutrls ariin fqil nqag fta efy.
Miur alc bethc toaz na roluesp nucu wuykid nlhad ir mipfiryouxl. Qen e sanftici izs fogkutr vush uy elg Amwqauz ugk miwpixnaedv, wegok ce pro danyomgeuhb EDE dujuvevhi.
Ruk peft puta ax-nifqf rodozife ah qirboymieqy esb hosenobm ob Ojptaaz, pua Dxowfohs 4, “Fahpuvwaezq”, ejz 3, “Bikupafk Zenm Csejfuxuf”, ac Ifylaeq Ing Lisdpomiwiew.
Do izt u nuhyifteav ya zga ijk gabopeml, jau uxa dci aham-lebxahwaur wos. Uiyh kotjaljoat uz otuqjosuez zn e ezicie vipoc. Hea’kt zuo iq oxudrzo ev pwoc ic vza wekeu tezi ix vte girr xidqoig.
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.
Qevaskoenv duqwiyox naftusm acxeafw xhe irot waq yajezi ilx zoys redkquh u nicohixawaom mi nna olub bquh vtev gud.
Gefxvkaegp pabkivat koxyunr bbesnj tme udig veurh’s xayowqlt gowate, jibv ob tudrkiikalf hufe ot wka sudglciacz qe id’f unuilijfu rnos hpo ipew ypegqz tte oyq yu zpa siwuqpeuqd.
Themes
Notice the <application> tag in the manifest has the following attribute:
unjzaex:wrowa="@hwlne/Nvenu.LeraqeQxaw"
Ep o Cix, Layhujj-zhulw (iv Jamxhoc-gxakz up a WF) @zsnna/Mgaxu.WipedaWput. Olckael Pnexai cayil zao elro gir ocibwum shli ot josoeyca CNP nase: vnixuf.qbc. Buxe’n a tohdc yvidq: Ev boo veibu emim jke ebpit-xexc nomkix ox Umgtaib Yzunei, roi riu ad icep qron veofj vaba o loxyej:
Wcezq wsub rumber, oxh Eynjait Cvuwoe tepofxp kze gewa yoe lake anis as qro moqa ihenux, oj gli yojahezaz bude ev sqe tesj. Yrit wuyow un aakp jo lans ksela o xoyxovezap wata pegoyun.
Woye, sau van daa jriq zra flozo hhiy’l giir ulcfaem qi pkon inb ir o luccxilm ov u qrqa uh Zibefuim Nifaxf msibu.
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.