Я пишу приложение на симуляторе в Eclipse с помощью инструментов adb / android и т. Д.
Пока я отлаживаю код своего вещательного приемника, приведенного ниже, в определенном разделе кода отладчик отключается, пока я остаюсь там на несколько секунд.
Это не дает мне достаточно времени для отладки и отключения,
ошибки похожи на
- 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
}
Полный код вещательного приемника выглядит так:
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
}
}
}
больше в