I have registered a Broadcast receiver in my application's manifest file like:
<receiver android:name="com.example.devicecommunication.MainActivity$proximityOffReceiver" android:enabled="true">
<intent-filter>
<action android:name="com.example.devicecommunication.PROXIMITYOFF" />
</intent-filter>
</receiver>
I have defined the receiver in MainActivity (as I want the receiver to be executed even when the activity is not in the foreground). I saw the link Android - how to unregister a receiver created in the manifest?. But I am confused if I should explicitly unregister the receiver, each time when the application is quit or when the back button is pressed? Thanks in advance!