2011-04-06 47 views

回答

2

我很抱歉,我不能給出一個更詳細的答案,但檢查出this project.

它利用一個AIDL與ITelephony接口進行通信。這應該從正確的方向開始。

1

您需要使用BroadcastReceiver。它應該是這個樣子:

public class CallReceiver extends BroadcastReceiver { 
@Override 
public void onReceive(Context context, Intent intent) { 
    String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE); 
    if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) { 
     Intent i = new Intent(context, IncomingCallPopup.class); 
     i.putExtras(intent); 
     i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
     try { 
      Thread.sleep(1000); 
     } catch (InterruptedException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 
     context.startActivity(i); 

    } 
} 
相關問題