android - BroadcastReceiver not being notified of BOOT_COMPLETED -


i'm trying rig service issues notification on "boot" , 1 once service running. i'm using following manifest:

<manifest      xmlns:android="http://schemas.android.com/apk/res/android"     package="my.project"     android:versioncode="1"     android:versionname="1.0" >      <uses-sdk         android:minsdkversion="14"         android:targetsdkversion="17"     />      <uses-permission android:name="android.permission.receive_boot_completed" />     <uses-permission android:name="android.permission.access_wifi_state" />     <uses-permission android:name="android.permission.change_wifi_state" />     <uses-permission android:name="android.permission.change_network_state" />     <uses-permission android:name="android.permission.access_network_state" />     <uses-permission android:name="android.permission.internet" />      <application         android:allowbackup="true"         android:icon="@drawable/ic_launcher"         android:label="@string/app_name"         android:theme="@style/apptheme"     >          <service             android:name=".manager"         />          <receiver             android:name=".bootstrap"         >             <intent-filter>                 <action android:name="android.intent.action.boot_completed" />             </intent-filter>          </receiver>      </application>  </manifest> 

unfortunately when reboot device, nothing displays , seems service never started.

here implementation broadcastreceiver subclass:

    @override     public void onreceive(context context, intent intent) {          log.d("test", "bootstrap run!");          int notificationid = 1;         notificationcompat.builder startnotification = new notificationcompat.builder(context)             .setsmallicon(r.drawable.ic_launcher)             .setcontenttitle("glance")             .setcontenttext("starting glance service.")         ;         notificationmanager notificationmanager = (notificationmanager)context.getsystemservice(context.notification_service);         notificationmanager.notify(notificationid, startnotification.build());          //         // run service.         //         intent startserviceintent = new intent(context, manager.class);         context.startservice(startserviceintent);      } 

any suggestions on might doing wrong or missing here that's causing things not work?

thanks!

if testing on android 3.1, please add activity application, run activity. starting android 3.1, manifest-registered broadcastreceivers blocked until manually runs 1 of components, typically means user has launched 1 of activities. see this nearly-two-year-old blog post more details.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -