<del id="d4fwx"><form id="d4fwx"></form></del>
      <del id="d4fwx"><form id="d4fwx"></form></del><del id="d4fwx"><form id="d4fwx"></form></del>

            <code id="d4fwx"><abbr id="d4fwx"></abbr></code>
          • Aidl掛接電話-創(chuàng)新互聯(lián)

            ITelephony.aidlAidl掛接電話
            package com.android.internal.telephony;
            
            interface ITelephony {
            void answerRingCall();
            boolean endCall();
            }

            MyPhoneService

            創(chuàng)新互聯(lián)于2013年開始,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元湛江做網(wǎng)站,已為上家服務(wù),為湛江各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:18982081108
            public class MyPhoneService extends Service {
                TelephonyManager manager;
                ITelephony telephony;
            
                @Override
            public IBinder onBind(Intent intent) {
            return null;
                }
            
                @Override
            public int onStartCommand(Intent intent, int flags, int startId) {
                    run();
            return super.onStartCommand(intent, flags, startId);
                }
            
            private void run() {
                    manager= (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
            // 獲取類類型        Class<TelephonyManager> clazz = TelephonyManager.class;
            try {
            // 通過方法名和參數(shù)找到方法            Method method = clazz.getDeclaredMethod("getITelephony", null);
            // 將此方法設(shè)為可用            method.setAccessible(true);
            // 執(zhí)行該方法            telephony = (ITelephony) method.invoke(manager, null);
                    }catch (NoSuchMethodException e) {
                        e.printStackTrace();
                    }catch (IllegalArgumentException e) {
                        e.printStackTrace();
                    }catch (IllegalAccessException e) {
                        e.printStackTrace();
                    }catch (InvocationTargetException e) {
                        e.printStackTrace();
                    }
            // 設(shè)置電話狀態(tài)監(jiān)聽        PhoneStateListener listener = new MyPhoneStateListener();
                    manager.listen(listener, PhoneStateListener.LISTEN_CALL_STATE);
                }
            
            class MyPhoneStateListener extends PhoneStateListener {
            
                    @Override
            public void onCallStateChanged(int state, String incomingNumber) {
            switch (state) {
            
            case TelephonyManager.CALL_STATE_OFFHOOK:// 當(dāng)摘機(jī)時(shí)                Log.i("onCallStateChanged", "CALL_STATE_OFFHOOK"
                                    + incomingNumber);
            
            try {
                                telephony.endCall();
                            }catch (RemoteException e) {
                                e.printStackTrace();
                            }
            break;
            
            case TelephonyManager.CALL_STATE_RINGING:// 當(dāng)響鈴時(shí)                Log.i("onCallStateChanged", "CALL_STATE_RINGING"
                                    + incomingNumber);
            try {
            // 接電話                    telephony.answerRingCall();
                            }catch (RemoteException e) {
                                e.printStackTrace();
                            }
            break;
            
            case TelephonyManager.CALL_STATE_IDLE: // 當(dāng)空閑時(shí)                Log.i("onCallStateChanged", "CALL_STATE_IDLE" + incomingNumber);
            break;
            default:
            break;
                        }
            super.onCallStateChanged(state, incomingNumber);
                    }
                }
            }

            當(dāng)前名稱:Aidl掛接電話-創(chuàng)新互聯(lián)
            網(wǎng)站地址:http://www.jbt999.com/article44/cdeiee.html

            成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站維護(hù)、軟件開發(fā)、全網(wǎng)營(yíng)銷推廣網(wǎng)站設(shè)計(jì)公司、外貿(mào)建站品牌網(wǎng)站制作

            廣告

            聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:[email protected]。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

            成都app開發(fā)公司

              <del id="d4fwx"><form id="d4fwx"></form></del>
              <del id="d4fwx"><form id="d4fwx"></form></del><del id="d4fwx"><form id="d4fwx"></form></del>

                    <code id="d4fwx"><abbr id="d4fwx"></abbr></code>
                  • 一级黄色日必网站 | 20岁天然美乳白虎女大生 | 黄色片在线 | 欧美第一页 | www午夜视频 |