Registration of boot-up in manifests can be successful, but registration of boot-up in code is not possible, Why is this?

  android, question

In the manifest:

<receiver android:name=".BootCompleteReceiver">
 <intent-filter>
 <action android:name="android.intent.action.BOOT_COMPLETED"/>
 </intent-filter>
 </receiver>

In the code:

IntentFilter intentFilter;
 BootCompleteReceiver bootCompleteReceiver;
 
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 intentFilter = new IntentFilter();
 intentFilter.addAction("android.intent.action.BOOT_COMPLETED");
 bootCompleteReceiver = new BootCompleteReceiver();
 registerReceiver(bootCompleteReceiver,intentFilter);
 bracket

They all wrote BootCompleteReceiver.

class BootCompleteReceiver extends BroadcastReceiver{
 
 @Override
 public void onReceive(Context context, Intent intent) {
 Toast.makeText(context,"hello world",Toast.LENGTH_SHORT).show();
 bracket
 bracket

However, the startup toast can be realized in the manifest, and the registerReceiver written in the code cannot realize the startup toast, Why is this? ?

The difference between dynamic registration and static registration.
The broadcast of manifest inside should be registered in inside, the global broadcast list of the system.
If the code is registered, it will only be registered after the app starts to execute this registration code.