Java Reference
In-Depth Information
whichismostlybasedonprocesslevelenforcementviastandardLinuxfeatures(such
as user and group IDs), places processes in a security sandbox.
Bydefault,thesandboxpreventsappsfromreadingorwritingtheuser'sprivatedata
(e.g.,contactsoremails),readingorwritinganotherapp'sfiles,performingnetwork
access,keepingthedeviceawake,accessingthecamera,andsoon.Appsthatneedto
accessthenetworkorperformothersensitiveoperationsmustfirstobtainpermission
to do so.
Androidhandlespermissionrequestsinvariousways,typicallybyautomaticallyal-
lowingordisallowingtherequestbaseduponacertificate,orbypromptingtheuser
tograntorrevokethepermission.Permissionsrequiredbyanapparedeclaredinthe
app'smanifestfile(discussedlaterinthischapter)sothattheyareknowntoAndroid
when the app is installed. These permissions won't subsequently change.
App Architecture
The architecture of an Android app differs from that of an application running on the
desktop.Apparchitectureisbaseduponcomponentsthatcommunicatewitheachother
viaintents,aredescribedbyamanifest,andmayuseapplicationresources.Collectively,
these items are stored in an app package.
Components
An Android app is a collection of components (activities, broadcast receivers, content
providers,andservices) that runinaLinuxprocessandthat aremanaged byAndroid.
Thesecomponentsshareasetofenvironmentalresources,includingdatabases,prefer-
ences, a filesystem, and the Linux process.
Note Notallthesecomponentsneedtobepresentinanapp.Forexample,oneapp
might consist of activities only, whereas another app might consist of activities and a
service.
Thiscomponent-orientedarchitectureletsanappreusethecomponentsofotherapps,
provided that those other apps permit reuse of their components. Component reuse
reduces overall memory footprint, which is very important for devices with limited
memory.
For example, suppose you're creating a drawing app that lets users choose a color
fromapalette,andsupposethatanotherapphasdevelopedasuitablecolorchooserand
permits this component to be reused. In this scenario, the drawing app can call upon
thatotherapp'scolorchoosertohavetheuserselectacolorratherthanprovideitsown
color chooser. The drawing app doesn't contain the other app's color chooser or even
Search WWH ::




Custom Search