2012-11-03 36 views
0

使用接近傳感器如何接收來電?如何將這項服務?使用接近接收電話

,這也許是我想在我的服務做....

try{ 
    //new DoBackgroundTask().execute() 

    Object powerManager = null; 
    Method method = powerManager.getClass().getDeclaredMethod("getSupportedWakeLockFlags"); 
    int supportedFlags = (Integer) method.invoke(powerManager); 
    Field f= PowerManager.class.getDeclaredField("PROXIMITY_CALL_RECIEVE_WAKE_LOCK"); 


} 
catch(Exception E){ 

} 

回答

0

您可以使用代碼here,方法answerPhoneAidl是你所需要的。當接近傳感器發出警報時調用它。