自己把log写入到文件中,注意文件别存在sd卡里面,BOOT_COMPLETED时,sd有时会没有加载完成不能写入的。

解决方案 »

  1.   

    我现在把BroadcastReceiver中BOOT_COMPLETED改成TIME_TICK,想先让我看到Service启动起来,怎么让程序跑起来啊?按Run绿三角图标没用啊
      

  2.   


    <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.filegee.second">    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>    <application android:allowBackup="true" android:label="@string/app_name"
            android:icon="@drawable/ic_launcher" android:theme="@style/AppTheme">
            <receiver android:name=".LaunchReceiver">
                <intent-filter>
                    <action android:name="android.intent.action.BOOT_COMPLETED"/>
                </intent-filter>
            </receiver>        <service android:name=".BGService" android:exported="false"></service>
        </application></manifest>
      

  3.   


        @Override
        public void onReceive(Context context, Intent intent) {
            Intent intent1 = new Intent(context , BGService.class);
            // 启动指定Server
            context.startService(intent1);
        }
      

  4.   

    你加个Activity再调试呗,apk不运行激活一次开机是不会自启动的
      

  5.   

    Quote: 引用 5 楼 xinyi 的回复:

    [code=java]
        @Override
        public void onReceive(Context context, Intent intent) {
            Intent intent1 = new Intent(context , BGService.class);
            // 启动指定Server
            context.startService(intent1);
        }
    不知道跑没跑起来?关机开机就跑起来了啊。
    可以看看DDMS有没有你的进程,也可以在收到广播或者service启动的地方加log打印。
    “BOOT_COMPLETE”发出来的时候也会有系统log。
      

  6.   

    抓一下log不就都清楚了
    http://blog.csdn.net/tiantang198707/article/details/9145071