đồ áN cơ sở

  • Published on
    21-Jun-2015

  • View
    1.246

  • Download
    5

Embed Size (px)

Transcript

  • 1. B GIO DC V O TO TRNG I HC K THUT CNG NGH TP. HCM N C STM HIU H IU HNH ANDROIDV VIT NG DNG DEMONgnh: CNG NGH THNG TINChuyn ngnh: CNG NGH PHN MM Ging vin hng dn : Ths. Nguyn Thy Loan Sinh vin thc hin : Anh Phng MSSV: 0951020197Lp: 09DTHCTP. H Ch Minh, 2012

2. 1NHIM V NKhoa: CNG NGH THNG TINPHIU GIAO TI N/ KHA LUN TT NGHIP(Phiu ny c dn trang u tin ca quyn bo co A/KLTN)1. H v tn sinh vin/ nhm sinh vin c giao ti (s s trong nhm 1): 1) ANH PHNG MSSV: 0951020197 Lp: 09DTHC Ngnh: CNG NGH THNG TIN Chuyn ngnh : CNG NGH PHN MM2. Tn ti: TM HIU H IU HNH ANDROID V VIT NG DNG DEMO3. Cc d liu ban u : .................................................................................................... .......................................................................................................................................... .......................................................................................................................................... ..........................................................................................................................................4. Cc yu cu ch yu : .................................................................................................... .......................................................................................................................................... .......................................................................................................................................... .......................................................................................................................................... ..........................................................................................................................................5. Kt qu ti thiu phi c: 1) ..................................................................................................................................... 2) ..................................................................................................................................... 3) ..................................................................................................................................... 4) ..................................................................................................................................... Ngy giao ti: ./../ Ngy np bo co: ./../TP. HCM, ngy thng nm . Ch nhim ngnh Ging vin hng dn chnh(K v ghi r h tn)(K v ghi r h tn)GVHD: Nguyn Thy Loan SVTH: Anh Phng 3. 2MC LCCHNG I : TNG QUAN .................................................................................. 31.1. S LC V CC H IU HNH ..................................................... 31.2. ANDROID ................................................................................................... 3CHNG II: C S L THUYT ..................................................................... 92.1. Delving vi my o DALVIK .................................................................... 92.2. Kin trc h iu hnh Android ............................................................. 102.3. Cc thnh phn trong ng dng Android.............................................. 13CHNG III: NG DNG DEMO ................................................................... 393.1. Phn tch chc nng ................................................................................. 393.2. Xy dng chc nng ................................................................................. 40CHNG IV: KT LUN V KIN NGH .................................................... 46TI LIU THAM KHO .................................................................................... 47GVHD: Nguyn Thy Loan SVTH: Anh Phng 4. 3CHNG I : TNG QUAN1.1. S LC V CC H IU HNH H iu hnh l chng trnh chy trn h thng my tnh, qun l cc ti nguyn trn my tnhv l mi trng cho cc ng dng chy trn n.Ngy nay, khi nim h iu hnh khng ch l trn my tnh m cn c m rng cho nhiu thit b in t khc chng hng nh in thoi thng minh ( smart phone), cc thit b cm tay PDA v.vNh vy h iu hnh di ng l h iu hnh chy trn h thng my c tnh di ng cao.Vi c th , h iu hnh di ng phi c nhng kh nng c bit m nhng h iu hnh thng thng khng c c.Chng hn nh n phi chy trn h thng my c cu hnh my hn ch v tc b vi x l, b nh s dng, phi chy c n nh lin tc trong mt thi gian di m ch s dng mt lng in nng nh, trong sut thi gian chy c th duy tr cc kt ni mng khng dy m bo lin lcMt s h iu hnh tiu biu: Trn my tnh c nhn: MS DOS, MS WINDOW , MACOS, LINUX, UNIX Trn in thoi thng minh: Android, Sybian, Window Mobile, iPhone OS, BlackBerry, S60, Bada OS, Palm OS.. Ngoi ra cn c cc h iu hnh chy trn mainframe, server, th chip Trong phm vi n ny chng ta s ni v h iu hnh Android dnh cho in thoi.1.2. ANDROIDAndroid h iu hnh dnh cho in thoi di ng c pht trin bi Google v ngy cng tr nn ph bin vi cc hng lin tc ra mt cc mu in thoi s dng Android.GVHD: Nguyn Thy LoanSVTH: Anh Phng 5. 4 Giao din mn hnh kha (Android 2.2) Giao din mn hnh chnh (Android 2.2) Android c xy dng trn nhn linux v c phn phi min ph. Khng ging nh Windows mobile v Apple iPhone, tuy c hai u cung cp mi trng pht trin ng dng phong ph v n gin d tip cn nhng lun c s u tin cho cc ng dng mc nh c sn ca h iu hnh (native applications).Vi Android mi ng dng u c vit trn cng mt tp API, th nn khng c s phn bit gia cc ng dng mc nh v cc ng dng ca bn th ba.Ngi dng hon ton c th thay th mi ng dng mc nh bng cc ng dng yu thch ca mnh, thm ch ngay c mn hnh thc hin cuc gi m mn hnh nh (home scream). Cc nh pht trin ng dng cho Android da trn ngn ng Java. S ra mt ca Android vo ngy 5 thng 11 nm 2007 gn vi s thnh lp lin minh thit b cm tay m ngun m, bao gm 78 cng ty phn cng v phn mm vin thng nhm mc ch to nn chun m cho in thoi di ng trong tng lai. Google cng b hu ht cc m ngun Android theo bn cp php Apache.GVHD: Nguyn Thy Loan SVTH: Anh Phng 6. 5 Cc thnh vin ca lin minh di ng m. Cc ng dng c sn trn Android Mt in thoi Android thng thng s i km vi mt vi ng dng c sn, bao gm: Mt trnh email tng thch vi Gmail Chng trnh qun l tin nhn SMS Chng trnh qun l thng tin c nhn, bao gm c lch lm vic, danh b v c ng b ha vi dch v Google Phin bn thu gn ca Google Map cho in thoi, bao gm StreetView, tm kim a ch, ch ng, tnh trng giao thng Trnh duyt Web da trn nhn Webkit.GVHD: Nguyn Thy Loan SVTH: Anh Phng 7. 6 Chng trnh tn gu (Chat). Trnh a phng tin ( chi nhc, xem phim). Android MarketPlace cho php ngi dng ti v v ci t cc ng dng mi.Tt c cc ng dng c sn u c vit bng ngn ng Java v s dng Android SDK.Cc d liu v thng tin ngi dng c cc ng dng c sn s dng nh thng tin v danh b vn hon ton c th c s dng bi cc ng dng ca bn th ba. Tng t vy, ng dng ca bn hon ton c th x l cc s kin nh cc cuc gi n, nhn mt tin nhn mi thay cho cc ng dng c sn. Truy cp phn cngAndroid bao gm cc th vin API gip n gin ha ti a vic s dng phn cng ca thit b. iu m bo rng bn khng cn phi bn tm nhiu n vic ng dng ca mnh c th chy nh mong i trn nhiu thit b khc nhau hay khng, min l thit b c h tr Android.Android SDK bao gm cc API cho phn cng :GPS, Camera, kt ni mng, WIFI, Bluetooth, con quay gia tc, mn hnh cm ng, qun l nng lng Dch v chy nnAndroid h tr cc ng dng v dch v c thit k chy n. Do kch thc nh ca mn hnh in thoi nn ti mt thi im ch c th thy mt ng dng.Dch v chy nn gip to ra cc thnh phn ng dng v hnh thc hin t ng mt tc v no m khng cn phi c s tng tc ca ngi dng.V d nh mt dch v chy nn c chc nng chn cuc gi n i vi cc s in thoi c trong black list chng hn. SQLite DatabaseBi v tnh cht nh gn v b hn ch v phn cng ca in thoi di ng, cho nn i hi vic lu tr v truy xut d liu phi nhanh chng v hiu qu.Android h tr h qun tr nh gn SQLite, v cung cp cho ng dng ccGVHD: Nguyn Thy Loan SVTH: Anh Phng 8. 7 API thao tc. Mc nh mi ng dng u c chy trong SandBox (hp ct) iu ny c ngha l ni dung ca tng database ng vi tng ng dng ch c th truy cp bng chnh ng dng . Tuy nhin cng c cc c ch cc ng dng chia s, trao i cc database vi nhau. H thng thng boThng bo l cch thc tiu chun m thit b bo cho ngi dng c mt s kin no xy ra. Chng hn nh c cuc gi ti, my sp ht pin S dng cc API bn c th cho ng dng ca mnh thng bo ti ngi dng bng m thanh, rung, hoc thm ch c n LED ca thit b. Ti u ha b nh v qun l tin trnhVic qun l b nh v tin trnh trong Android cng c mt cht khc bit gin nh cng ngh Java v .NET, Android s dng mt b Run-time ca ring mnh vi cng ngh o ha qun l b nh ca cc ng dng ang chy.Khng ging nh nhng nn tn khc, Android Run-time cng ng thi qun l lun c thi gian sng ca ng dng.Android m bo cc ng dng u c p ng bng cch dng v hy cc tin trnh khng cn thit gii phng cc ti nguyn cho cc tin trnh c u tin cao hn.Trong bi cnh , u tin c xc nh ty thuc vo ng dng m ngi dng ang tng tc.Android m bo rng cc ng dng c hy mt cch nhanh chng, ng thi cng khi ng l nhanh cng khng km nu cn.iu ny tht s quan trng trong mt mi trng m bn thn ng dng khng th t kim sot c thi gian sng cho mnh. Android software development kit (SDK)B SDK ca Android bao gm mi th cn thit gip bn c th lp trnh, debug, test ng dng Android. Android API: Ct li ca b SDK l th vin cc hm API v Google cng ch s dng b API ny xy dng cc ng dng c sn cho Android. Development tool: SDK bao gm rt nhiu cng c gip bin dch, sa li v h tr trong vic lp trnh ng dng.GVHD: Nguyn Thy Loan SVTH: Anh Phng 9. 8Android Emulator: Trnh gi lp thit b chy Android thc s vinhiu Skin thay th, cc k tin li cho vic test ng dng Androidngay trn my tnh m khng cn phi thng qua mt thit b chyAndroid thc.Ti liu: SDK bao gm mt b ti liu rt chi tit, gii thch cn kchnh xc nhng g bao gm trong mi page, class cng vi cch sdng chng. Ngoi ti liu v code, cn c nhng ti liu dng getting started v gii thch cc nguyn tc v c ch hot ngca ng dng trong Android.Code mu: SDK bao gm cc ng dng mu n gin minh ha chocc tnh nng ni bt trn Android, cng nh cc ng dng democch s dng cc tnh nng ca b API. Kin trc ng dng tng ca Android l vic khuyn khch ti s dng li cc thnh phn c, cho php ng dng ca bn c th chia s Activity, Service, D liu vi cc ng dng khc nhau trong gii hn bn t ra.Sau y l kin trc ca mi ng dng Android:- Activity Manager : Kim sot vng i ca Activity.- View : Xy dng g