Android Service使用需要注意事項

來源:互聯網
上載者:User

標籤:android   http   使用   ar   art   cti   bs   .net   設計   

Service作為Android架構設計的一個重要組件,開發中使用很多

介紹Android Service的文章很多。這裡記錄一下自己使用Service的心得,方便自己和朋友查閱

1.同一個包內的activity和service,如果service沒有設定屬性android:process=":remote"的 話,service會和activity跑在同一個進程中,由於一個進程只有一個UI線程,所以,service和acitivity就是在同一個線程裡 面的。(http://bbs.csdn.net/topics/330159598,第9樓)

2.一定要在AndroidManifest.xml中註冊服務,否則調用startService後沒反應(實際上是服務沒啟動),要是沒注意到這點調試的時候很糾結

先就這麼多了。慢慢總結

Android Service使用需要注意事項

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.