文献翻译.docx
- 文档编号:12325011
- 上传时间:2023-04-18
- 格式:DOCX
- 页数:15
- 大小:25.10KB
文献翻译.docx
《文献翻译.docx》由会员分享,可在线阅读,更多相关《文献翻译.docx(15页珍藏版)》请在冰豆网上搜索。
文献翻译
AndroidAPILevels
AsyoudevelopyourapplicationonAndroid,it'susefultounderstandtheplatform'sgeneralapproachtoAPIchangemanagement.It'salsoimportanttounderstandtheAPILevelidentifierandtheroleitplaysinensuringyourapplication'scompatibilitywithdevicesonwhichitmaybeinstalled.
ThesectionsbelowprovideinformationaboutAPILevelandhowitaffectsyourapplications.
Forinformationabouthowtousethe"FilterbyAPILevel"controlavailableintheAPIreferencedocumentation,see Filteringthedocumentation attheendofthisdocument.
WhatisAPILevel?
APILevelisanintegervaluethatuniquelyidentifiestheframeworkAPIrevisionofferedbyaversionoftheAndroidplatform.
TheAndroidplatformprovidesaframeworkAPIthatapplicationscanusetointeractwiththeunderlyingAndroidsystem.TheframeworkAPIconsistsof:
∙Acoresetofpackagesandclasses
∙AsetofXMLelementsandattributesfordeclaringamanifestfile
∙AsetofXMLelementsandattributesfordeclaringandaccessingresources
∙AsetofIntents
∙Asetofpermissionsthatapplicationscanrequest,aswellaspermissionenforcementsincludedinthesystem
EachsuccessiveversionoftheAndroidplatformcanincludeupdatestotheAndroidapplicationframeworkAPIthatitdelivers.
UpdatestotheframeworkAPIaredesignedsothatthenewAPIremainscompatiblewithearlierversionsoftheAPI.Thatis,mostchangesintheAPIareadditiveandintroduceneworreplacementfunctionality.AspartsoftheAPIareupgraded,theolderreplacedpartsaredeprecatedbutarenotremoved,sothatexistingapplicationscanstillusethem.Inaverysmallnumberofcases,partsoftheAPImaybemodifiedorremoved,althoughtypicallysuchchangesareonlyneededtoensureAPIrobustnessandapplicationorsystemsecurity.AllotherAPIpartsfromearlierrevisionsarecarriedforwardwithoutmodification.
TheframeworkAPIthatanAndroidplatformdeliversisspecifiedusinganintegeridentifiercalled"APILevel".EachAndroidplatformversionsupportsexactlyoneAPILevel,althoughsupportisimplicitforallearlierAPILevels(downtoAPILevel1).TheinitialreleaseoftheAndroidplatformprovidedAPILevel1andsubsequentreleaseshaveincrementedtheAPILevel.
ThefollowingtablespecifiestheAPILevelsupportedbyeachversionoftheAndroidplatform.
PlatformVersion
APILevel
Android3.0
11
Android2.3.3
10
Android2.3
9
Android2.2
8
Android2.1
7
Android2.0.1
6
Android2.0
5
Android1.6
4
Android1.5
3
Android1.1
2
Android1.0
1
UsesofAPILevelinAndroid
TheAPILevelidentifierservesakeyroleinensuringthebestpossibleexperienceforusersandapplicationdevelopers:
∙ItletstheAndroidplatformdescribethemaximumframeworkAPIrevisionthatitsupports
∙ItletsapplicationsdescribetheframeworkAPIrevisionthattheyrequire
∙Itletsthesystemnegotiatetheinstallationofapplicationsontheuser'sdevice,suchthatversion-incompatibleapplicationsarenotinstalled.
EachAndroidplatformversionstoresitsAPILevelidentifierinternally,intheAndroidsystemitself.
ApplicationscanuseamanifestelementprovidedbytheframeworkAPI—
∙android:
minSdkVersion —SpecifiestheminimumAPILevelonwhichtheapplicationisabletorun.Thedefaultvalueis"1".
∙android:
targetSdkVersion —SpecifiestheAPILevelonwhichtheapplicationisdesignedtorun.Insomecases,thisallowstheapplicationtousemanifestelementsorbehaviorsdefinedinthetargetAPILevel,ratherthanbeingrestrictedtousingonlythosedefinedfortheminimumAPILevel.
∙android:
maxSdkVersion —SpecifiesthemaximumAPILevelonwhichtheapplicationisabletorun. Important:
Pleasereadthe
Forexample,tospecifytheminimumsystemAPILevelthatanapplicationrequiresinordertorun,theapplicationwouldincludeinitsmanifesta
minSdkVersion attribute.Thevalueof android:
minSdkVersion wouldbetheintegercorrespondingtotheAPILeveloftheearliestversionoftheAndroidplatformunderwhichtheapplicationcanrun.
Whentheuserattemptstoinstallanapplication,orwhenrevalidatinganappplicationafterasystemupdate,theAndroidsystemfirstchecksthe
∙Ifa android:
minSdkVersion attributeisdeclared,itsvaluemustbelessthanorequaltothesystem'sAPILevelinteger.Ifnotdeclared,thesystemassumesthattheapplicationrequiresAPILevel1.
∙Ifa android:
maxSdkVersion attributeisdeclared,itsvaluemustbeequaltoorgreaterthanthesystem'sAPILevelinteger.Ifnotdeclared,thesystemassumesthattheapplicationhasnomaximumAPILevel.Pleasereadthe
Whendeclaredinanapplication'smanifest,a
minSdkVersion="5"/> ... TheprincipalreasonthatanapplicationwoulddeclareanAPILevelin android: minSdkVersion istotelltheAndroidsystemthatitisusingAPIsthatwere introduced intheAPILevelspecified.IftheapplicationweretobesomehowinstalledonaplatformwithalowerAPILevel,thenitwouldcrashatrun-timewhenittriedtoaccessAPIsthatdon'texist.ThesystempreventssuchanoutcomebynotallowingtheapplicationtobeinstalledifthelowestAPILevelitrequiresishigherthanthatoftheplatformversiononthetargetdevice. Forexample,the android.appwidget packagewasintroducedwithAPILevel3.IfanapplicationusesthatAPI,itmustdeclarea android: minSdkVersion attributewithavalueof"3".TheapplicationwillthenbeinstallableonplatformssuchasAndroid1.5(APILevel3)andAndroid1.6(APILevel4),butnotontheAndroid1.1(APILevel2)andAndroid1.0platforms(APILevel1). Formoreinformationabouthowtospecifyanapplication'sAPILevelrequirements,seethe DevelopmentConsiderations ThesectionsbelowprovideinformationrelatedtoAPIlevelthatyoushouldconsiderwhendevelopingyourapplication. Applicationforwardcompatibility Androidapplicationsaregenerallyforward-compatiblewithnewversionsoftheAndroidplatform. BecausealmostallchangestotheframeworkAPIareadditive,anAndroidapplicationdevelopedusinganygivenversionoftheAPI(asspecifiedbyitsAPILevel)isforward-compatiblewithlaterversionsoftheAndroidplatformandhigherAPIlevels.TheapplicationshouldbeabletorunonalllaterversionsoftheAndroidplatform,exceptinisolatedcaseswheretheapplicationusesapartoftheAPIthatislaterremovedforsomereason. ForwardcompatibilityisimportantbecausemanyAndroid-powereddevicesreceiveover-the-air(OTA)systemupdates.Theusermayinstallyourapplicationanduseitsuccessfully,thenlaterreceiveanOTAupdatetoanewversionoftheAndroidplatform.Oncetheupdateisinstalled,yourapplicationwillruninanewrun-timeversionoftheenvironment,butonethathastheAPIandsystemcapabilitiesthatyourapplicationdependson. Insomecases,changes below theAPI,suchthoseintheunderlyingsystemitself,mayaffectyourapplicationwhenitisruninthenewenvironment.Forthatreasonit'simportantforyou,astheapplicationdeveloper,tounderstandhowtheapplicationwilllookandbehaveineachsystemenvironment.TohelpyoutestyourapplicationonvariousversionsoftheAndroidplatform,theAndroidSDKincludesmultipleplatformsthatyoucandownload.EachplatformincludesacompatiblesystemimagethatyoucanruninanAVD,totestyourapplication. Applicationbackwardcompatibility AndroidapplicationsarenotnecessarilybackwardcompatiblewithversionsoftheAndroidplatformolderthantheversionagainstwhichtheywerecompiled. EachnewversionoftheAndroidplatformcanincludenewframeworkAPIs,suchasthosethatgiveapplicationsaccesstonewplatformcapabilitiesorreplaceexistingAPIparts.ThenewAPIsareaccessibletoapplicationswhenrunningonthenewplatformand,asmentionedabove,alsowhenrunningonlaterversionsoftheplatform,asspecifiedbyAPILevel.Conversely,becauseearlierversionsoftheplatformdonotincludethenewAPIs,applicationsthatusethenewAPIsareunabletorunonthoseplatforms. Althoughit'sunlikelythatanAndroid-powereddevicewouldbedowngradedtoapreviousversionoftheplatform,it'simportanttorealizethattherearelikelytobemanydevicesinthefieldthatrunearlierversionsoftheplatform.EvenamongdevicesthatreceiveOTAupdates,somemightlagandmightnotreceiveanupdateforasignificantamountoftime. SelectingaplatformversionandAPILevel Whenyouaredevelopingyourapplication,youwillneedtochoosetheplatformversionagainstwhichyouwillcompiletheapplication.Ingeneral,youshouldcompileyourapplicationagainstthelowestpossibleversionoftheplatformthatyourapplicationcansupport. Youcandeterminethelowestpossibleplatformversionbycompilingtheapplicationagainstsuccessivelylowerbuildtargets.Afteryoudeterminethelowestversion,youshouldcreateanAVDusingthecorrespondingplatformversion(andAPILevel)andfullytestyourapplication.Makesuretodeclarea a
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 文献 翻译
![提示](https://static.bdocx.com/images/bang_tan.gif)