如何在android中为启动接收器附加调试器?

时间:2012-10-06 03:52:50

标签: android eclipse debugging

我是android的新手。我在我的项目中启动了设备启动时启动了一项服务,但我不知道如何为它附加调试器。我想调试我的代码中的一些错误所以应该怎么做我继续这样做?请帮帮我。谢谢你提前

1 个答案:

答案 0 :(得分:-1)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.broadcast.receiver.example"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">

        <activity android:name=".BR_Example"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    <!-- Declaring broadcast receiver for wifi status changing event -->
        <receiver android:name=".MyReceiver " android:enabled="true" android:exported="false">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
            </intent-filter>
        </receiver>

    </application>

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

</manifest>

public MyReceiver extends BroadcastReceiver {   

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

     Intent myIntent = new Intent(context, YourService.class);
     context.startService(myIntent);
    }

我希望它会帮助你............