BroadcastReceiverを実装しようとしていますが、機能していません。仮想デバイスでは、このアプリケーションは完全に機能しています。私の実際のデバイス(Galaxy Nexus-Android 4.1.2)では何もしません!実際のデバイスからのログには、アプリケーションに関するエラーはありません。何か案は?
Outgoingcallinterceptor.java
package com.scoutman.lcr;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;
public class Outgoingcallinterceptor extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL))
{
Log.d("INFO","HELLO!!!");
Toast.makeText(context, "Hello!!!", Toast.LENGTH_LONG).show();
}
}
}
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.scoutman.lcr" android:versionCode="1" android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name">
<receiver android:name="Outgoingcallinterceptor">
<intent-filter >
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
</intent-filter>
</receiver>
</application>
</manifest>
ログ:
11-24 20:18:39.077: I/ActivityManager(306): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.contacts/.activities.DialtactsActivity bnds=[40,1040][168,1168] u=0} from pid 500
11-24 20:18:40.295: D/dalvikvm(306): WAIT_FOR_CONCURRENT_GC blocked 0ms
11-24 20:18:40.311: D/dalvikvm(1173): GC_CONCURRENT freed 295K, 6% free 12162K/12807K, paused 15ms+4ms, total 55ms
11-24 20:18:40.381: D/dalvikvm(306): GC_EXPLICIT freed 761K, 24% free 20098K/26183K, paused 3ms+9ms, total 89ms
11-24 20:18:43.412: I/ActivityManager(306): START {act=android.intent.action.CALL_PRIVILEGED dat=tel:xxxxxxxxxxxxx flg=0x10000000 cmp=com.android.phone/.PrivilegedOutgoingCallBroadcaster (has extras) u=0} from pid 11614
11-24 20:18:43.506: D/PhoneUtils(483): checkAndCopyPhoneProviderExtras: some or all extras are missing.
11-24 20:18:43.522: D/PhoneUtils(483): checkAndCopyPhoneProviderExtras: some or all extras are missing.
11-24 20:18:43.522: I/ActivityManager(306): START {act=com.android.phone.SIP_SELECT_PHONE dat=tel:xxxxxxxxxxxxx flg=0x10000000 cmp=com.android.phone/.SipCallOptionHandler (has extras) u=0} from pid 483
11-24 20:18:43.655: D/CallController(483): placeCall()... intent = Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxxxxxx (has extras) }
11-24 20:18:43.655: D/PhoneUtils(483): placeCall()... number: xxxxxxxxxxxx, GW: null, emergency? false
11-24 20:18:43.662: I/AudioService(306): AudioFocus requestAudioFocus() from AudioFocus_For_Phone_Ring_And_Calls
11-24 20:18:43.662: E/audio_hw_primary(131): Entering IN_CALL state, in_call=0
11-24 20:18:43.678: E/audio_hw_primary(131): Opening modem PCMs
11-24 20:18:43.952: I/ActivityManager(306): START {act=android.intent.action.MAIN flg=0x10840000 cmp=com.android.phone/.InCallScreen u=0} from pid 483
11-24 20:18:43.998: D/dalvikvm(483): GC_CONCURRENT freed 981K, 11% free 14039K/15687K, paused 14ms+4ms, total 61ms
11-24 20:18:44.037: D/PhoneStatusBar(387): disable: < expand icons ALERTS* ticker system_info back home recent clock >
11-24 20:18:44.045: D/AccelerometerListener(483): enable(true)
11-24 20:18:44.061: D/InCallScreen(483): onNewIntent: intent = Intent { act=android.intent.action.MAIN flg=0x10c40000 cmp=com.android.phone/.InCallScreen }, phone state = OFFHOOK
11-24 20:18:44.116: W/IInputConnectionWrapper(11614): showStatusIcon on inactive InputConnection
11-24 20:18:44.514: I/ActivityManager(306): No longer want com.android.settings (pid 12419): hidden #16
11-24 20:18:44.561: I/WindowState(306): WIN DEATH: Window{41e9b4d8 com.android.settings/com.android.settings.Settings paused=false}
11-24 20:18:44.616: D/AccelerometerListener(483): orientation: horizontal
11-24 20:18:47.475: D/InCallScreen(483): internalHangup()... phone state = OFFHOOK
11-24 20:18:47.475: D/PhoneUtils(483): hangup(): hanging up foreground call
11-24 20:18:47.475: D/PhoneUtils(483): - hangup(Call): regular hangup()...
11-24 20:18:47.811: D/CallNotifier(483): onDisconnect: cause = LOCAL, incoming = false, date = 1353784723664
11-24 20:18:47.819: D/CallNotifier(483): SignalInfoTonePlayer.run(toneId = 98)...
11-24 20:18:47.819: I/PowerManagerService(306): clearUserActivity for 10000ms from now
11-24 20:18:47.827: D/CallNotifier(483): InCallTonePlayer.run(toneId = 4)...
11-24 20:18:48.030: I/ActivityManager(306): START {cmp=com.android.contacts/.activities.DialtactsActivity u=0} from pid 483
11-24 20:18:48.131: D/dalvikvm(306): GC_FOR_ALLOC freed 1209K, 23% free 20211K/26183K, paused 74ms, total 74ms
11-24 20:18:48.139: E/audio_hw_primary(131): Leaving IN_CALL state, in_call=1, mode=0
11-24 20:18:48.139: E/audio_hw_primary(131): Closing modem PCMs
11-24 20:18:48.155: I/ActivityManager(306): moveTaskToBack: 5
11-24 20:18:48.194: D/AccelerometerListener(483): enable(false)
11-24 20:18:48.194: D/PhoneStatusBar(387): disable: < expand icons alerts* ticker system_info back home recent clock >
11-24 20:18:48.311: I/AudioService(306): AudioFocus abandonAudioFocus() from AudioFocus_For_Phone_Ring_And_Calls
11-24 20:18:48.311: V/DialpadFragment(11614): Dialpad.onResume,66: qloc,4 dtwd,3 hptc,0 tg,56 fdin,0 tm,1 hnt,1 bes,1 ,0
11-24 20:18:48.428: D/dalvikvm(1173): GC_CONCURRENT freed 383K, 5% free 12177K/12807K, paused 15ms+4ms, total 45ms
11-24 20:18:48.491: I/ActivityManager(306): Displayed com.android.contacts/.activities.DialtactsActivity: +329ms (total +5s6ms)
11-24 20:18:48.623: D/dalvikvm(1173): WAIT_FOR_CONCURRENT_GC blocked 0ms
11-24 20:18:48.662: D/dalvikvm(1173): GC_EXPLICIT freed 185K, 6% free 12063K/12807K, paused 2ms+2ms, total 39ms
11-24 20:18:49.225: D/dalvikvm(11614): WAIT_FOR_CONCURRENT_GC blocked 0ms
11-24 20:18:49.295: D/dalvikvm(11614): GC_EXPLICIT freed 1248K, 10% free 15160K/16775K, paused 3ms+17ms, total 65ms
11-24 20:18:49.303: I/ActivityManager(306): moveTaskToBack: 110
11-24 20:18:49.412: W/IInputConnectionWrapper(11614): showStatusIcon on inactive InputConnection
11-24 20:18:49.452: D/dalvikvm(306): GC_CONCURRENT freed 993K, 20% free 21179K/26183K, paused 5ms+11ms, total 111ms