這篇文章教你如何幫助用戶自動接聽或者掛斷來電。當然并不是我原創的代碼,我只不過是把stackoverflow上的一些代碼整合了一下,做個代碼的二傳手。

源碼
AcceptOrRejectCallDemo
源碼中用了MVP的模式,只是最簡單的使用,如果不熟悉的話剛好可以學學,邏輯部分在IncomingPresenter類中。
首先需要監聽來電的廣播
在AndroidManifest文件中添加:
<receiver android:name=".incomingcall.PhoneListener"> <intent-filter android:priority="1000"> <action android:name="android.intent.action.PHONE_STATE" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.NEW_OUTGOING_CALL" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </receiver>
新聞名稱:Android如何幫助用戶自動接聽或者掛斷來電-創新互聯
轉載源于:http://www.yijiale78.com/article48/djjeep.html
成都網站建設公司_創新互聯,為您提供微信公眾號、小程序開發、網站收錄、定制開發、網站制作、網站排名
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯