2012-07-25 45 views
1

我想測試處理電話,所以我做了一個小應用程序,它應該寫入一個傳入/傳出電話呼叫日誌。這裏的廣播接收機: 1:Android手機呼叫接收器不工作

第二個:

import android.content.BroadcastReceiver; 
import android.content.Context; 
import android.content.Intent; 
import android.util.Log; 

public class OutgoingCallReceiver extends BroadcastReceiver { 

@Override 
public void onReceive(Context context, Intent intent) { 

    Log.d("DEBUGING", "OUTGOING CALL DETECTED !!"); 

    } 
} 

最後清單

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.test.callrec" 
android:versionCode="1" 
android:versionName="1.0" > 

<uses-sdk 
    android:minSdkVersion="8" 
    android:targetSdkVersion="15" /> 

<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" /> 
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> 

<application 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" > 
    <receiver android:name=".IncomingCallReceiver" > 
     <intent-filter> 
      <action android:name="android.intent.action.PHONE_STATE" /> 
     </intent-filter> 
    </receiver> 
    <receiver android:name=".OutgoingCallReceiver" > 
     <intent-filter> 
      <action android:name="android.intent.action.NEW_OUTGOING_CALL" /> 
     </intent-filter> 
    </receiver> 
</application> 

而問題是,我的recievers是從來沒有打過....我不知道爲什麼,有誰能幫忙?

+0

,所以我發現,這個工程在Android 2.2和犯規工作在4.0+上工作有人知道爲什麼嗎? – user924941 2012-07-25 17:32:42

回答

2

顯然是從3.1+您的接收器將啓動用戶確實只後您的活動的東西至少一次,所以我沒有一個活動的應用程序將無法正常工作

+0

你是100%正確的......我有類似的問題,現在開放它的工作。謝謝。 – 2013-05-18 13:39:54