2011-04-06 46 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); 

    } 
} 
相关问题