解决方案 »

  1.   

    http://blog.csdn.net/knxw0001/article/details/9965701
      

  2.   

    为什么要继承IntentService?你直接继承Service试试
    或者你试试不要在接受广播消息内部继承Service类,在外部重新建立Service类
      

  3.   

    是不是没有点击应用。
    从Android 3开始,第一次启动需要用户触发。
      

  4.   

    有activity和主界面的。也运行过。
      

  5.   


              <receiver android:name=".BootBroadcastReceiver" android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
                <intent-filter>
                    <action android:name="android.intent.action.BOOT_COMPLETED" />
                    <category android:name="android.intent.category.LAUNCHER"/>
                    <!-- <action android:name="android.intent.action.QUICKBOOT_POWERON" />
                     /> -->
                </intent-filter>
            </receiver>    中的 <category android:name="android.intent.category.LAUNCHER"/>
    改为 <category android:name="你的包名"/>
      

  6.   

      <receiver android:name=".BootBroadcastReceiver" 里的<category android:name="android.intent.category.LAUNCHER"/>这个可以去掉没有用,可以在这个接受广播xml里添加<intent-filter android:priority="100">,同时你看下log有有没有开机广播。我这边试是可以的。不行的话贴下log我看下。
      

  7.   

    打log看看,接收到开机广播了吗
      

  8.   

    还是不行啊,我把完整代码弄上来:
    http://www.cndais.com/sfj.rar
      

  9.   

    我最近也做了这个,也是开机没法启动。最后我用了一个闹钟机制。
    Intent intent = new Intent(this, InitBroadcastReceiver.class);
    PendingIntent pendingIntent = PendingIntent.getBroadcast(
    getApplicationContext(), 0, intent, 0);
    long firstTime = SystemClock.elapsedRealtime();
    AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
    am.setRepeating(AlarmManager.RTC, firstTime, 1000 * 10, pendingIntent);
    这样开机后,会启动,不晓得还有没有更好的办法
      

  10.   

    你这个代码是写在什么地方的?我改了下代码,最近也在测试这个功能,下载application中
    Intent intent = new Intent(this, InitBroadcastReceiver.class);
    PendingIntent pendingIntent = PendingIntent.getBroadcast(
    getApplicationContext(), 0, intent, 0);
    long firstTime = System.currentTimeMillis();
    AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
    // 一五分钟执行一次
    am.setRepeating(AlarmManager.RTC_WAKEUP,
    firstTime + 10 * 1000, 1000 * 60 * 2, pendingIntent);