Yes, its normal. You registered broadcast in activity via code, app got killed and broadcast too.
If U want your broadcast works, when app doesn't launched, define broadcast in AndroidManifest file.
If U want to your user can "unregister" broadcast, you can add extra logic to your onRecieve function.
When you let to your user "unregister" receiver, just save it in your prefs, or in DB, whatever, and check this value before do work:
@Override public void onReceive(Context context, Intent intent) {
boolean isUnregisteredByUser = getSharedPreferences("MyPrefs", context.MODE_PRIVATE)
.getBoolean("IS_UNREGISTERED", false);
if(!isUnregisteredByUser){
/* do stuff, handle intent etc */
}
}
This is easy way, but maybe bad way...