Restrict Broadcast Receiver to application

前端 未结 3 1632
无人及你
无人及你 2021-01-14 21:51

I am working on broadcast receiver and stuck in a problem.

I am receiving a broadcast receiver in Manifest file.



        
3条回答
  •  孤街浪徒
    2021-01-14 22:43

    You said "My problem will solve if it is not receiving anything when application is not opened".

    Here how I understand your question and appropriate answer.

    android:enabled

    Whether or not the broadcast receiver can be instantiated by the system — "true" if it can be, and "false" if not. The default value is "true".

    If you want to enable your receiver at runtime, you can set the state to disabled initially. You can do so in the manifest file:

    
    
    
    

    Source: http://developer.android.com/guide/topics/manifest/receiver-element.html#enabled

    http://www.grokkingandroid.com/enabling-and-disabling-broadcastreceivers/

提交回复
热议问题