init
Initializes KInAppBrowser with the provided Activity.
This method must be called before using open to ensure that Chrome Custom Tabs can be launched from the correct Activity context.
Best Practices
Call this method in Activity's
onCreate()oronResume()Re-initialize when switching between activities
The Activity reference is stored as WeakReference to prevent memory leaks
Example
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Initialize KInAppBrowser
KInAppBrowser.init(this)
}
}Content copied to clipboard
Parameters
activity
The Activity from which Custom Tabs will be launched. Should be the current foreground Activity.