【问题标题】:How do i attach debugger for bootup receiver in android?如何在 android 中为启动接收器附加调试器?
【发布时间】:2012-10-06 03:52:49
【问题描述】:

我是 android 的新手。我已经在我的项目中完成设备的启动时启动了一项服务,但我不知道如何为其附加调试器。即我想为一些错误调试我的代码所以应该如何我继续吗?请帮帮我。在此先感谢

【问题讨论】:

    标签: android eclipse debugging


    【解决方案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);
        }
    

    希望对你有所帮助............

    【讨论】:

    • 这是我已经完成的我只是想知道我应该如何调试该代码
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-06
    • 2012-03-21
    • 1970-01-01
    • 1970-01-01
    • 2011-12-19
    相关资源
    最近更新 更多