adb/android ツールなどを使用して、Eclipse のシミュレーターでアプリを作成しています。以下のブロードキャストレシーバー コードをデバッグしているときに、コードの特定のセクションで、そこに数秒間留まるとデバッガーが切り離されます。
デバッグして切断するのに十分な時間がありません。
エラーは次のようなものです
- 03-01 20:42:38.293: I/CallListener(320): onReceive.. 03-01 20:42:48.319: W/ActivityManager(59): ブロードキャスト
BroadcastRecord のタイムアウト{45098250 android.intent.action.PHONE_STATE} -
receiver=android.os.BinderProxy@450d2070 03-01 20:42:48.319:
W/ActivityManager(59): タイムアウト中の受信者: ResolveInfo{45032058
mahmed.net.apps.CallListener p=0 o=0 m=0x108000} 03 -01 20:42:48.353:
I/Process(59): シグナルを送信しています。PID: 320 SIG: 3 03-01 20:42:48.353:
I/dalvikvm(320): threadid=3: シグナル 3 03-01 20:42:48.353 に反応: I/dalvikvm(320): スタック トレースを書き込みました'/data/anr/traces.txt' 03-01
20:42:48.362: I/Process(59): シグナルを送信しています。PID: 59 SIG: 3 03-01
20:42:48.362: I/dalvikvm(59): threadid=3: シグナル 3 に反応しています
デバッガが切断されるセクションは
if (newCallState.equals(TelephonyManager.EXTRA_STATE_OFFHOOK))
{
Utils.log(TAG, "off hook...");
// Do necessary work to start off a service etc ..
// If I debug here for few seconds the debugger gets detached.. without any errors
}
BroadcastReceiver の完全なコードは次のようになります。
public class CallListener extends BroadcastReceiver
{
Context m_context;
/**
* Called on application thread
*/
@Override
public void onReceive(Context context, Intent intent)
{
Utils.log(TAG, "onReceive..");
m_context = context;
String strAction = intent.getAction();
Assert.assertNotNull(strAction);
if(strAction.equals(android.telephony.TelephonyManager.ACTION_PHONE_STATE_CHANGED))
{
handleCallStateChanged(context, intent);
}
}
private void handleCallStateChanged(Context context, Intent intent)
{
Utils.log(TAG, "handling call state changed");
String newCallState = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
if (newCallState.equals(TelephonyManager.EXTRA_STATE_OFFHOOK))
{
Utils.log(TAG, "off hook...");
// Do necessary work to start off a service etc ..
// If I debug here for few seconds the debugger gets detached.. without any errors
}
}
}
でより多くの