Wednesday, 15 August 2012

bootcompleted - Android BOOT_COMPLETED not received when application is closed -


I know that this question has been said a lot on the site, however, I am unable to find a solution. My BOOT_COMPLETED receiver is not called when the app is not running.

Clear:

  & lt; Manifest xmlns: android = "http://schemas.android.com/apk/cres/ android" package = "com.example.startuptest" android: versionCode = "1" Android: versionName = "1.0" Android: installLocation = " Internal only "& gt; & Lt; Usage-permission Android: name = "android.permission.RECEIVE_BOOT_COMPLETED" /> & Lt; Use-sdk android: minSdkVersion = "8" Android: targetSdkVersion = "17" /> & Lt; Android: Android: icon = "true_android": icon = & Lt; Activity Android: name = "com.example.startuptest.MainActivity" android: label = "@ string / app_name" & gt; & Lt; Intent-Filter & gt; & Lt; Action Android: name = "android.intent.action.MAIN" /> & Lt; Category android: name = "android.intent.category.LAUNCHER" /> & Lt; / Intent-Filter & gt; & Lt; / Activity & gt; & Lt; Receiver Android: name = "com.example.startuptest.StartUpBootReceiver" & gt; & Lt; Intent-Filter & gt; & Lt; Action Android: name = "android.intent.action.BOOT_COMPLETED" /> & Lt; / Intent-Filter & gt; & Lt; / Receiver & gt; & Lt; / Application & gt; & Lt; / Reveal & gt; StartUpBootReceiver:  
  Public Class StartUpBootReceiver broadcasts the receiver receiver {@ relevant onride public reference on refrain (reference reference, intended intent) {Log D. ("Startuptest" "startupboot receiver" + intent. Gate action ()); If ("android.intent.action.BOOT_COMPLETED" .equals (intent.getAction ())) {log d. ("Startuptest", "startupboot receiver BOOT_COMPLETED"); }}}   

If the application is running and I simulate a call with

  ADB Shell Broadcast - a android.intent.action.BOOT_COMPLETED   

This event is obtained correctly, however, if the application closes, the event is not received, nor has it been initially received.

I have launched then, it is several times to ensure that it is registered.

Edit: In the log I can see that all the closed applications (YouTube, file observer, etc.) get booted event, not mine.

Cheers

When I start my app BOOT_COMPLETED, then I know it's working I log D will add, it will not be shown. I'll show it to toast . Manifest XML

  & lt; Receiver Android: name = "com.example.startuptest.StartUpBootReceiver" Android: enabled = "true" android: exported = "true" & gt; & Lt; Intent-Filter & gt; & Lt; Action Android: name = "android.intent.action.BOOT_COMPLETED" /> & Lt; Category android: name = "android.intent.category.DEFAULT" /> & Lt; / Intent-Filter & gt; & Lt; / Receiver & gt;    

No comments:

Post a Comment