Use this flag:

intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); 


On Tuesday, January 24, 2012 12:30:06 AM UTC-5, Ravi Pandey wrote:
>
> I have tried to design a Service in such a way that once it's receiver 
> can receive the BOOT_COMPLETED intent , the service gets started. 
> Basically the startService() function gets called when the Service's 
> BroadCastReceiver receives the BOOT_COMPLETED intent inside it's 
> onReceive() function. 
>
> Now using Gingerbread environment, when I try to send the 
> "android.intent.action.BOOT_COMPLETED" intent (lets say from terminal 
> using the 'am' command). My Service (which is currently in NOT running 
> state) is able to receive this intent in it's onReceive() and 
> processes the further executions. 
>
> But when I am using the ICS environment, when I try to send the 
> "android.intent.action.BOOT_COMPLETED" intent as mentioned above, my 
> Service (which is currently in NOT running state) is NOT able to 
> receive this intent in it's onReceive(). 
> For this case, when I try somehow to start my Service by calling it's 
> onCreate() explicitly by using some other Application and then if I 
> again send the BOOT_COMPLETED intent as above, then it is able to 
> receive this intent in it's onReceive() (i.e. only when my Service is 
> in running state). 
>
> I would really appreciate if someone can confirm that in case of using 
> ICS environment , do we need to start a service first before actually 
> making it able to receive an intent in it's onReceive() function ? 
> Also, the reasoning for this would be highly appreciable, if there is 
> some  :-)  ? 
>
> Thanks in advance !!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to