2023年全國碩士研究生考試考研英語一試題真題(含答案詳解+作文范文)_第1頁
已閱讀1頁,還剩22頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、<p>  實現(xiàn)Android手機(jī)音樂應(yīng)用</p><p><b>  摘 要:</b></p><p>  Android平臺是谷歌在2007年推出的新一代智能手機(jī)平臺。Android提供了對音樂播放的支持,這可能會是廣大開發(fā)商所關(guān)注的。所以Android手機(jī)串流音樂的發(fā)展需要關(guān)注串流音樂到Android手機(jī)的HTTP流。Android是開源的并且還提供

2、一個易于使用的開發(fā)工具包。本文為您介紹Android的架構(gòu)和組件,以及對Android應(yīng)用的解剖,包括功能的活動、意圖接收器、服務(wù)、內(nèi)容提供商等。這個應(yīng)用是基于Android的音樂需求(MOD)開發(fā),致力于人們可以隨時隨地簡單方便地訪問和享受他們的數(shù)字音樂。該軟件可以直接連接人們的內(nèi)容,沒有同步或上傳他們的文件的麻煩。音樂需求(MOD)的用戶也可以與家人和朋友在一個私人的,安全的組分享其個人媒體。Rhythm Box分享局域網(wǎng)上的音樂庫

3、,DDAP數(shù)據(jù)包通過互聯(lián)網(wǎng)發(fā)送到服務(wù)器的共享庫。MOD使用數(shù)字音頻訪問協(xié)議(DAAP)對共享庫中的音樂實時需求進(jìn)行響應(yīng)。</p><p><b>  前 言:</b></p><p>  Android是移動設(shè)備一個軟件棧,包括操作系統(tǒng),中間件和關(guān)鍵應(yīng)用程序。開放手機(jī)聯(lián)盟(OHA)在2007年11月12日發(fā)表了谷歌的Android SDK[1]。這個Android

4、SDK提供了用Java編程語言在Android平臺上開發(fā)應(yīng)用程序所需的必要的工具和API。</p><p>  Android平臺是開放的系統(tǒng)架構(gòu),具有多功能的開發(fā)和調(diào)試環(huán)境,而且還優(yōu)化了圖形系統(tǒng),支持多種媒體和一個非常強(qiáng)大的瀏覽器,以便支持多種可擴(kuò)展的用戶體驗。它可以重用,更換部件和有高效率的數(shù)據(jù)庫支持,并支持各種無線通信手段。它使用了Dalvik虛擬機(jī)為移動設(shè)備做了很大程度上的優(yōu)化[2]。</p>

5、<p>  Android的各種各樣功能如下,Android有它自己基于開源的WebKit引擎的瀏覽器。它支持各種硬件,如GSM、藍(lán)牙、EDG、3G、WIFI、相機(jī)等。它還支持常見的音頻,視頻和靜止圖像格式(MPEG4、H.264、MP3、AAC、AMR、JPG、PNG、GIF)。</p><p>  由于Android支持Wi-Fi和各種音頻格式,用戶可以從全球IP靈活地訪問和控制音樂的分流。 A

6、ndroid的架構(gòu)和Android應(yīng)用程序分析會在第二節(jié)和第三節(jié)中。從遠(yuǎn)程臺式機(jī)到Android手機(jī)流音樂應(yīng)用程序的設(shè)計分析在第四節(jié)中會提到,本文最后部分給出結(jié)論和參考文獻(xiàn)。</p><p><b>  Android架構(gòu)</b></p><p>  圖1Android架構(gòu)</p><p>  上圖是Android架構(gòu)和它主要的組成部分。<

7、;/p><p><b>  應(yīng)用程序?qū)?lt;/b></p><p>  Android附帶了一套核心應(yīng)用,包括電子郵件客戶端,短信程序,日歷,地圖,瀏覽器,聯(lián)系人等,將在第四節(jié)描述的是在應(yīng)用層。所有應(yīng)用程序都使用Java編程語言編寫的。</p><p><b>  應(yīng)用框架層</b></p><p>  應(yīng)

8、用程序框架提供了用于創(chuàng)建Android應(yīng)用程序的類。它還提供了硬件訪問的通用抽象和管理的用戶界面和應(yīng)用程序資源。Android開發(fā)人員可以核心應(yīng)用一樣擁有框架API訪問權(quán)限。</p><p><b>  核心庫</b></p><p>  Android在內(nèi)核上運行,包括各種C\C++的核心,例如libc和SSL,以及一個用于播放音頻和視頻媒體庫。surface ma

9、nager提供顯示管理,包括SGL和OpenGL的二維、三維圖形的圖形庫,用于網(wǎng)絡(luò)瀏覽器和互聯(lián)網(wǎng)安全的SSL和WebKit。</p><p>  Android運行時</p><p>  Android還包含了一組在Java編程語言核心庫中功能最有用的核心庫。</p><p>  每一個Android應(yīng)用程序在Dalvik虛擬機(jī)中運行。Dalvik可以使應(yīng)用有效地在

10、移動設(shè)備上的虛擬機(jī)上運行。Dalvik虛擬機(jī)執(zhí)行Dalvik占用最小的內(nèi)存優(yōu)化文件的可執(zhí)行文件(.dex)。虛擬機(jī)是基于寄存器的,并且運行被Java complier的“dx”工具轉(zhuǎn)化成.dex格式的類。</p><p>  Dalvik虛擬機(jī)依賴于Linux內(nèi)核基本功能,例如線程和低級別的內(nèi)存管理。</p><p><b>  Linux內(nèi)核</b></p&g

11、t;<p>  核心服務(wù)(包括硬件驅(qū)動程序、過程和內(nèi)存管理;安全、網(wǎng)絡(luò)和電源管理)是由Linux2.6內(nèi)核的處理。內(nèi)核還在硬件和堆棧部分之間的提供了抽象層。</p><p>  Android應(yīng)用程序的分析</p><p>  一個Android 應(yīng)用程序由4個組件組成:Activity、Intent Receiver、Service和Content Provider。并不是

12、每一個應(yīng)用程序需要這四個組件。但應(yīng)用程序,都會用到他們當(dāng)中的一些組合。一旦用戶決定用到哪些組件,就需要在AndroidManifest.xml文件中列出。這是一個XML文件,其中包含用戶為該應(yīng)用程序聲明的組件和他們的使用范圍和要求[2] [4]。</p><p><b>  Activity</b></p><p>  Activity是Android四個組件中最常見

13、的。一個Activity通常是應(yīng)用程序顯示出來的屏幕。每個Activity都繼承了Activity的基類,這個類將顯示用戶界面和響應(yīng)事件,大多數(shù)應(yīng)用程序有多個屏幕。例如,一個文本消息程序可能有一個屏幕顯示將消息發(fā)送到聯(lián)系人列表。第二個屏幕所選擇的聯(lián)系人寫郵件和其他屏幕查看舊郵件或更改設(shè)置,這些屏幕都將會被當(dāng)做Activity。顯示另外一個屏幕需要啟動一個新的Activity。在在某些情況下可能會返回到前面一個Activity里面的值。例

14、如一個Activity,讓用戶選擇一個照片然后返回選擇照片給被調(diào)用的Activity。</p><p>  當(dāng)一個新的屏幕打開時,先前的屏幕暫停,并放入到歷史堆棧中。用戶可以通過在歷史導(dǎo)航到以前屏幕,在不恰當(dāng)?shù)臅r候保存的屏幕可以從歷史堆棧中刪除。Android會保留從主屏幕啟動的每個應(yīng)用程序的歷史棧。</p><p>  Intent Receiver </p><p&

15、gt;  Android使用一個特殊的類Intent來移動畫面。Intent描述的是一個應(yīng)用程序到底想做什么。Intent兩個最重要數(shù)據(jù),action和action所需要的數(shù)據(jù)。最典型的值有:MAIN,VIEW, PICK,EDIT等等。這些數(shù)據(jù)被表示為一個統(tǒng)一資源標(biāo)識符(URI)。例如,在瀏覽器中查看網(wǎng)站,將創(chuàng)建具有VEIW值的action和一個網(wǎng)站URI數(shù)據(jù)的意圖。NewIntent(Android.content.Intent.V

16、IEW_ACTION,ContentURI.create("http://anddev.org"));</p><p>  還有一個相關(guān)的叫做IntentFilter的類。當(dāng)Intent請求做一些事情,IntentFilter會選出怎么樣的Intent(或者Intent receiver,見下文)有能力處理這個Intent。用戶發(fā)布個人信息后,activity經(jīng)過IntentFilter選出V

17、iew Intent,然后顯示該用戶的聯(lián)系方式。Activity在AndroidManifest.xml文件發(fā)布IntentFilters。</p><p>  畫面的切換是由Intent解析決定的。為了導(dǎo)航到下一個畫面,activity調(diào)用startActivity(myIntent)。然后該系統(tǒng)根據(jù)IntentFilters安裝應(yīng)用程序和選擇IntentFilters最佳匹配myIntent的activity

18、。新新的activity啟動由Intent所引起。這個Intent解析過程稱為startActivity時的運行時。</p><p>  想要應(yīng)用程序執(zhí)行外部事件時可以使用Intent Receiver。例如,當(dāng)電話鈴響時,或當(dāng)數(shù)據(jù)網(wǎng)絡(luò)可用時,或當(dāng)午夜的時候可以使用Intent Receiver。Intent Receiver不會顯示用戶界面,盡管當(dāng)發(fā)生了一些有趣的事情時Intent Receiver可能會顯示通

19、知提醒用戶。Intent receiver也注冊在AndroidManifest.xml中,但也可以編寫代碼Context.registerReceiver()進(jìn)行注冊。程序不是一定要對用到的Intent進(jìn)行調(diào)用,當(dāng)Intent receiver被觸發(fā)時系統(tǒng)會啟動程序。應(yīng)用程序通過Context.broadcastIntent()可以向他人發(fā)送自己的Intent。</p><p><b>  Servi

20、ce </b></p><p>  Service是一段周期長沒有用戶界面的代碼。一個很好的例子,就是一個媒體播放器播放列表的歌曲。在媒體播放器這個應(yīng)用程序,有一個或多個活動,讓用戶選擇歌曲并開始播放。然而音樂播放時不會使用activity,因為用戶希望切換歌曲時只需改變播放的歌曲而不是啟動一個新的界面。在這種情況下,媒體播放器的activity可以開始使用Context.startService()

21、在后臺運行保持音樂服務(wù)。系統(tǒng)將會繼續(xù)播放,直到音樂播放完成。(你可以學(xué)到更多通過閱讀Life Cycle of an Android Application你會知道service優(yōu)先級)。請注意,你可以連接到一個service(并啟動它,如果它尚未運行)通過Context.bindService()方法。當(dāng)連接到一個service,service通過接口進(jìn)行傳遞。音樂播放這個service,就可以實現(xiàn)暫停,重播等。</p>

22、<p>  Content Provider</p><p>  應(yīng)用程序可以在文件中存儲數(shù)據(jù),SQLite數(shù)據(jù)庫,參數(shù)或其他有意義的機(jī)制。當(dāng)需要應(yīng)用程序的數(shù)據(jù)將與其他應(yīng)用程序共享時,content Provider將會很有用。content provider是一個類,這個類實現(xiàn)了一系列標(biāo)準(zhǔn)的方法,這些方法可以讓其他應(yīng)用程序存儲和檢索那些被content provider處理過的數(shù)據(jù)。</p&g

23、t;<p>  MUSIC ON DEMAND–Android音樂應(yīng)用程序</p><p>  現(xiàn)在可用的方案中,人們收藏音樂是通過吧音樂存到手機(jī)的存儲卡中。這是個讓人忙碌和單調(diào)乏味的工作。為了克服這一問題并且實現(xiàn)得到用戶希望想要聽的歌曲后搜索到這個歌曲,這就是這個應(yīng)用程序需要實現(xiàn)的。</p><p>  有了這個系統(tǒng),用戶將能夠在任何地方的共享媒體文件(臺式機(jī)/筆記本電腦)

24、。要做到這一點,用戶需要的僅僅是一個互聯(lián)網(wǎng)連接,然而互聯(lián)網(wǎng)如今已經(jīng)是非常普及了。</p><p>  用戶不需要真正公開分享音樂文件就能夠分享到音樂。請求的客戶端將能夠發(fā)揮不從自己的工作站或Android手機(jī)的媒體播放音樂,而是將文件復(fù)制到他們的系統(tǒng)。分析用戶簡介后,用戶列表的朋友可以有保持各自的共享媒體的訪問。每當(dāng)用戶給出一個請求,請求就會被經(jīng)過驗證的用戶賬戶分享的系統(tǒng)抓取并且然后流回到發(fā)出請求的客戶端系統(tǒng)。因

25、此,服務(wù)器不需要特別大的數(shù)據(jù)存儲空間。該應(yīng)用程序由三個主要組成部分:</p><p><b>  桌面客戶端界面</b></p><p>  客戶機(jī)應(yīng)用程序界面,這是與服務(wù)器進(jìn)行通信的唯一目的而設(shè)計的。它作為媒體播放器和服務(wù)器之間的調(diào)解人。用戶可以通過此接口創(chuàng)建他/她的私人帳戶。該接口也將開展通過互聯(lián)網(wǎng)流媒體音頻文件的任務(wù)。流媒體協(xié)議實際上是這個接口和服務(wù)器之間的工作

26、。</p><p>  圖2 接口用于Rhythm boplayer和服務(wù)器之間的通信。</p><p>  Android客戶端</p><p>  Android移動平臺上類似的界面。用戶是不能夠分享到Android手機(jī)的媒體。接口將只接收流媒體,并在Android手機(jī)上的播放器中播放。</p><p>  文件會在從共享文件列表中順序播

27、放。用戶可以隨機(jī)地要求任何音頻文件,該文件都會同步播放。</p><p>  圖3 Android應(yīng)用程序的流媒體音樂和共享音樂庫列表</p><p><b>  服務(wù)器</b></p><p>  它執(zhí)行了兩次大的操作,從客戶端獲取,分流到另一個客戶端并且從桌面客戶端存儲整個音樂序列。服務(wù)器通過全球IP進(jìn)行所有的通信。</p>

28、<p><b>  圖4系統(tǒng)架構(gòu)</b></p><p>  上圖顯示music on demand這個系統(tǒng)在Android手機(jī)上詳細(xì)的視圖。上圖所示和之前解釋的,這個系統(tǒng)由三個主要組成部分客戶端,服務(wù)器和Android手機(jī)應(yīng)用。進(jìn)一步解釋三個組成部分之間的實際溝通的細(xì)節(jié)是如何發(fā)生的。</p><p>  桌面客戶端接口和Rhythmbox音樂媒體播放器之間

29、的消息流。(我們使用libopendaap library/API用于rhythmboxDAAP之間的通信)。</p><p>  1.首先,創(chuàng)建一個將確定本地的DAAP客戶,這個將會定義到DAAP共享中。</p><p>  2.然后連接到本地的DAAP共享,忽略從本地網(wǎng)絡(luò)中其他的DAAP的共享。</p><p>  3. DAAP給本地Rhythm播放器提出請求

30、,如下:</p><p>  客戶端的Rhythmbox說明</p><p>  ---/server-info---->請求服務(wù)器</p><p>  <------- MSRV-------服務(wù)器響應(yīng)</p><p>  ---/content-codes-->要求的內(nèi)容</p><p>  &l

31、t;------- mccr-------響應(yīng)內(nèi)容</p><p>  ---/login---------->登錄</p><p>  <------- mlog-------登錄響應(yīng)</p><p>  ---/update--------->更新請求</p><p>  <------- mupd-------更

32、新回應(yīng)</p><p>  ---/databases------>數(shù)據(jù)庫請求</p><p>  <------- avdb--------數(shù)據(jù)的基礎(chǔ)上響應(yīng)(DBID)</p><p>  ---/db/id/items---->請求的歌曲</p><p>  <------- ADBS-------數(shù)據(jù)庫中的歌曲列

33、表</p><p>  -/db/id/containers->請求播放列表</p><p>  <-------apply-------列出數(shù)據(jù)庫中的播放列表</p><p>  4.如果歌曲請求了由服務(wù)器,消息流如下:</p><p>  -/db/id/items/<ID> .MP3->請求MP3。<

34、/p><p>  <--stream-mp3-file------- 播放mp3</p><p>  桌面客戶端界面和服務(wù)器之間的消息流</p><p><b>  1.消息流如下:</b></p><p><b>  客戶端服務(wù)器說明</b></p><p>  ----

35、- MRTT------>包的往返響應(yīng)超時</p><p>  <------- MRTT-------服務(wù)器響應(yīng)</p><p>  -------- mlog----->登錄包的訪問權(quán)限。</p><p>  <------- MLRP-------登錄響應(yīng)(用戶ID)</p><p>  --------- MS

36、RV---->本地機(jī)器描述</p><p>  <-------OK-------服務(wù)器響應(yīng)</p><p>  --------- SNIF------>歌曲名單(10首歌曲/包)</p><p>  <------OK-------服務(wù)器響應(yīng)</p><p>  --------- SNIF------>&l

37、t;/p><p>  <------OK-------</p><p>  2.客戶正在登錄,等待來自服務(wù)器的任何請求。</p><p>  3.當(dāng)服務(wù)器請求一首歌的消息流如下:</p><p><b>  客戶端服務(wù)器說明</b></p><p>  <-------的STRM-----

38、-歌曲請求(歌曲ID)</p><p>  --------- STRP------>歌曲答復(fù)</p><p>  <------- OK -------服務(wù)器響應(yīng)</p><p>  ----- STREAM --->歌曲的實際流量</p><p>  <------- OK -------服務(wù)器響應(yīng)</p&g

39、t;<p>  Android客戶端和服務(wù)器之間的消息流</p><p><b>  1.消息流如下:</b></p><p>  Android的服務(wù)器說明</p><p>  --------- MRTT------>往返時間超時計算</p><p>  <------- MRTT-----

40、--服務(wù)器響應(yīng)</p><p>  -------- mlog----->登錄數(shù)據(jù)包進(jìn)行驗證</p><p>  <------- MLRP-------登錄響應(yīng)(用戶ID)</p><p>  --------- msrq---->共享庫的請求</p><p>  <------- MSRP-------共享庫名單&

41、lt;/p><p>  2.當(dāng)一個特定的庫被選中,那么消息流如下:</p><p>  Android的服務(wù)器說明</p><p>  --------- snrq------>歌曲的請求</p><p>  <------- snrp-------歌曲和元數(shù)據(jù)</p><p>  3.當(dāng)點擊消息播放一首歌曲是

42、:</p><p>  Android的服務(wù)器說明</p><p>  -------- STRM------>歌曲請求(歌曲ID)</p><p>  <-------- STRP------播放答復(fù)(HTTP播放路徑)</p><p>  圖5 從桌面客戶端到Android手機(jī)的音樂播放</p><p>

43、;  從上圖中我們可以看到,執(zhí)行播放通過使用的DAAP和Rhythmbox使用全球IP到Android手機(jī)是很方便的。</p><p><b>  結(jié) 論 </b></p><p>  我們喜歡各種各樣音樂,當(dāng)然,我們有4000 +的歌曲集,這些我們并不能的全部放到自己的Android手機(jī)上。也不能放到我們的朋友那邊。然而,Music On Demand可以讓你點播

44、你的朋友的歌曲集合,無論你在哪里且不會占用超過1MB的空間。這個應(yīng)用程序,可以聽任何你收藏的音樂。不僅僅是自己的收藏音樂,你也可以邀請朋友成為你的朋友列表和來播放他們的音樂。</p><p>  這是一個非常簡單的應(yīng)用程序,并且可以在Android上的播放媒體音樂,因此它的名字是Rayss Tunes。第一步是在桌面上運行的桌面客戶端界面應(yīng)用程序。這個可以作為進(jìn)入你的音樂庫的通徑。第二步是在你的Android手機(jī)

45、上安裝應(yīng)用Rayss Tunes。一旦你在這兩個位置以相同的用戶名和密碼登錄,你的本地音樂庫將可以在你Android手機(jī)中使用。你還可以得到任何已經(jīng)邀請為你的朋友的Music on Demand網(wǎng)絡(luò)上的音樂。絕對沒有其他陪著你,只是登錄應(yīng)用程序就好了。</p><p>  Rayss Tunes一個非常簡單的應(yīng)用程序,很方便。安裝桌面應(yīng)用程序,然后安裝Android應(yīng)用程序、登錄、然后音樂就有了。添加你的朋友,你

46、可以給他們一個請求,如果他們接受,你就能看到他們的音樂。</p><p>  因此,這個應(yīng)用程序讓用戶點擊用戶想聽的音樂和快速播放音樂和專輯,這就是了這個應(yīng)用程序的使用。</p><p><b>  參考文獻(xiàn)</b></p><p>  [1] Open Hanset Alliance, http://www.openhandsetallian

47、ce.com/.</p><p>  [2] Android-An Open Handset Alliance Project, http://code.google.com-/intl/zh-CN/Android/.</p><p>  [3] OpenDAAP Library- http://crazney.net/programs/itunes/libopendaap.html.&l

48、t;/p><p>  [4] http://andbook.anddev.org.</p><p>  [5] C. Haseman,Android Essentials, PDF Electronic Book, 2008. Available from: http://Androidos.cc/dev/index.php.</p><p>  [6] http://

49、www.developer.Android.com.</p><p>  A Novel approach for streaming music to Android phone through Global IP using DAAP</p><p>  Vishal A. Kamble; Annasaheb Dange College of Engineering and Techn

50、ology; Dept of Computer Science; Ashta, India.</p><p>  Amol S. Dange; Annasaheb Dange College of Engineering and Technology; Dept of Computer Science; Ashta, India.</p><p>  Sachin P. Yadav; An

51、nasaheb Dange College of Engineering and Technology; Dept of Computer Science; Ashta, India.</p><p><b>  ABSTRACT </b></p><p>  Android platform is new generation of smart mobile pho

52、ne platform launched by Google in 2007.Android provides support to music streaming, which is probably a concern of vast number of developers. So as the development of music streaming to Android phone is concern its need

53、an http streams to stream music to Android phone. Android is an open sources and providing an easy to use development kit. This paper introduce you the Architecture and components of Android and analyzes the anatomy of A

54、ndroid</p><p>  INTRODUCTION </p><p>  Android is a software stack for mobile devices that include an operating system, middleware and key application. The Open Handset Alliance (OHA) released t

55、he Google Android SDK on November 12, 2007 [1]. The Android SDK provides the tools and APIs necessary to begin developing application on the Android platform using Java programming language. </p><p>  Androi

56、d platform is of open system architecture, with versatile development and debugging environment, but also supports a variety of scalable user experience, which has optimized graphics systems, rich media support and a ver

57、y powerful browser. It enables reuse and replacement of components and an efficient database support and support various wireless communication means. It uses a Dalvik virtual machine heavily optimized for mobile devices

58、 [2]. </p><p>  The Various feature of Android are as fallow, Android have its own browser based on open source WebKit engine. It has various hardware dependent feature lke GSM, Bluetooth, EDGE, 3G, WiFi, Ca

59、mera etc. It has media support for Common audio, video, and still image formats (MPEG4,H.264,MP3,AAC,AMR,JPG,PNG,GIF) </p><p>  As the Android support the Wi-Fi and various audio format user can flexibly acc

60、ess and control the streaming of music from a Global IP. The Android architecture and anatomy of Android application are addressed in Section II and III. Based on the analyses, the design of Streaming application to stre

61、am music from remote desktop machine to Android phone is then presented in section IV and the last section gives the conclusion and various references.</p><p>  ANDROID ARCHITECTURE</p><p>  Fig

62、ure 1 Android architecture</p><p>  The Android architecture and its main components are shown in above Figure 1.</p><p>  Application Layer</p><p>  Android will ship with a set of

63、 core applications including an email client, SMS program, calendar, maps, browser, contacts, and others even the application, which will be described in Section IV is in application layer. All applications are written u

64、sing the Java programming language.</p><p>  Application Framework</p><p>  The application framework provides the classes used to create Android applications. It also provides a generic abstrac

65、tion for hardware access and manages the user interface and application resources. Developers have the full access to same framework APIs used by the core application. </p><p><b>  Libraries</b>&

66、lt;/p><p>  Running on top of the kernel, Android includes various C\C++ core libraries such as libc and SSL as well as, A media library for playback of audio and video. A surface manager to provide display man

67、agement, Graphics libraries that include SGL and OpenGL for 2D and 3D graphics, SQLite for native database support, SSL and WebKit for integrated web browser and internet security.</p><p>  Android Runtime&l

68、t;/p><p>  Android includes a set of core libraries that provides most of functionality available in the core libraries of the Java programming language. </p><p>  Every Android application runs in

69、 its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run mobile VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is

70、 optimized for minimal memory footprint. The VM is register-based, and runs classes complied by Java language complier that have been transformed into the .dex format by the included “dx” tool. </p><p>  The

71、 Dalvik VM relies on the Linux kernel for underlying functionality such as threading and low-level memory management. </p><p>  Linux Kernel</p><p>  Core services (including hardware drivers, p

72、rocess and memory management, security, network, and power management) are handled by a Linux 2.6 kernel. The kernel also provides an abstraction layer between the hardware and the remainder of the stack. </p><

73、;p>  ANATOMY OF ANDROID APPLICATION</p><p>  There are four building blocks to an Android application: Activity, Intent Receiver, Service, and Content Provider Not </p><p>  Every application

74、 needs to have all four, but user application will be written with some combination of these. Once user has decided what components he need for his application, he should list them in a file called AndroidManifest.xml. T

75、his is an XML file where user declares the components of user application and what their capabilities and requirements are[2][4]. </p><p><b>  Activity</b></p><p>  Activities are th

76、e most common of the four Android building blocks. An activity is usually a single screen in your application. Each activity is implemented as a single class that extends the Activity base class. Your class will display

77、a user interface composed of Views and respond to events. Most applications consist of multiple screens. For example, a text messaging application might have one screen that shows a list of contacts to send messages to,

78、a second screen to write the message to the</p><p>  When a new screen opens, the previous screen is paused and put onto a history stack. The user can navigate backward through previously opened screens in t

79、he history. Screens can also choose to be removed from the history stack when it would be inappropriate for them to remain. Android retains history stacks for each application launched from the home screen.</p>&l

80、t;p>  Intent Receiver </p><p>  Android uses a special class called Intent to move from screen to screen. Intent describes what an application wants done. The two most important parts of the Intent data s

81、tructure are the action and the data to act upon. Typical values for action are MAIN (the front door of the application), VIEW, PICK, EDIT, etc. The data is expressed as a Uniform Resource Indicator (URI). For example, t

82、o view a website in the browser, you would create Intent with the VIEW action and the data set to a Website-</p><p>  NewIntent(Android.content.Intent.VIEW_ACTION,ContentURI.create("http://anddev.org&qu

83、ot;)); </p><p>  There is a related class called an IntentFilter.While an Intent is effectively a request to do something, an Intent filter is a description of what Intents an activity (or Intent receiver, s

84、ee below) is capable of handling. An activity that is able to display contact information for a person would publish an IntentFilter that said that it knows how to handle the action VIEW when applied to data representing

85、 a person. Activities publish their IntentFilters in the AndroidManifest.xml file. </p><p>  Navigating from screen to screen is accomplished by resolving Intents. To navigate forward, an activity calls star

86、tActivity(myIntent). The system then looks at the Intent filters for all installed applications and picks the activity whose Intent filters best matches myIntent. The new activity is informed of the Intent, which causes

87、it to be launched. The process of resolving Intents happens at run time when startActivity is called. </p><p>  You can use an Intent Receiver when you want code in your application to execute in reaction to

88、 an external event, for example, when the phone rings, or when the data network is available, or when it's midnight. Intent receivers do not display a UI, although they may display Notifications to alert the user if

89、something interesting has happened. Intent receivers are also registered in AndroidManifest.xml, but you can also register them from code using Context.registerReceiver(). Your application </p><p><b> 

90、 Service </b></p><p>  A Service is code that is long-lived and runs without a UI. A good example of this is a media player playing songs from a play list. In a media player application, there would pr

91、obably be one or more activities that allow the user to choose songs and start playing them. However, the music playback itself should not be handled by an activity because the user will expect the music to keep playing

92、even after navigating to a new screen. In this case, the media player activity could start a service u</p><p>  Content Provider </p><p>  Applications can store their data in files, a SQLite da

93、tabase, preferences or any other mechanism that makes sense. A content provider, however, is useful if you want your application's data to be shared with other applications. A content provider is a class that impleme

94、nts a standard set of methods to let other applications store and retrieve the type of data that is handled by that content provider. </p><p>  MUSIC ON DEMAND–STREAMING APPLICATION FOR ANDROID</p>&l

95、t;p>  In present available schemes, people take on and off their music collection from phone memory, which is really a hectic and tedious job. To overcome this and to get user what he wants to listen and tap his feet

96、on music, this application is implemented [3][5][6] .</p><p>  With this system, user will be able to share the media files from anywhere (Desktops/Laptops).To do so, what user needs is just an Internet conn

97、ection, which is common these days. </p><p>  User will be able to share the media without actually sharing the files publicly. The requesting clients will be able to play the media from their workstation or

98、 Android Phone without actually copying the files to their system. Proper user profiling is done and friend list of the users is maintained to get access of the respective shared media. </p><p>  Whenever a

99、user requests for a track, it will be fetched from the system on which it is shared under the authenticated users account and then streamed back to the requesting client. So the server need not have exceptionally large d

100、ata storage space. There are three main components of this system- </p><p>  Desktop Client Interface </p><p>  The application interface for the client machine, which is designed for the sole p

101、urpose of communicating with the server. It is acting as mediator between the media player and the server. </p><p>  The user is able to create his/her private account through this interface. This interface

102、will also carry out the task of streaming the audio files through internet. The streaming protocol is actually working between this interface and server.</p><p>  Figure 2 Interface for communicating between

103、 Rhythm boplayer and Server.</p><p>  Android Client </p><p>  The similar interface on the Android mobile platform. The user is not able to share the media from the Android phone. The interface

104、 will just receive the streamed media and play it using the media player on the Android mobile. </p><p>  The files will be played sequentially from the list of shared files. The user can demand any audio fi

105、le randomly. The file will be streamed and played simultaneously.</p><p>  Figure 3 Android applications for streaming music and to get the list of shared music library</p><p>  The Server </

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論