The generated MainActivity.java is one line, public class MainActivity extends BridgeActivity {}; BridgeActivity creates the WebView, the bridge and the plugins. Override its lifecycle methods as in any AppCompatActivity. BookNest's version shows a toast with two values set in Gradle 19,597 (Gradle Files):
package com.example.booknest;
import android.os.Bundle;
import android.widget.Toast;
import com.getcapacitor.BridgeActivity;
public class MainActivity extends BridgeActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
// registerPlugin(MyLocalPlugin.class) goes here, before super.onCreate (Section 4.10)
super.onCreate(savedInstanceState);
String msg = "Native " + BuildConfig.VERSION_NAME + ", API " + BuildConfig.API_BASE;
Toast.makeText(this, msg, Toast.LENGTH_LONG).show();
}
}The same commit added android:screenOrientation="portrait" to the activity in the manifest and set app_name in res/values/strings.xml to "BookNest Shop".
On iOS (not run here), Capacitor 8.5 243,123 adopted UIScene: AppDelegate.swift keeps launch code in didFinishLaunchingWithOptions, and the new SceneDelegate.swift creates the CAPBridgeViewController. To customize the bridge, subclass it, override capacitorDidLoad(), and create the subclass in SceneDelegate. npx cap migrate adds SceneDelegate.swift to an unmodified pre-8.5 project.