Skip to content

[feat] Android plugins should be able to call our own MainActivity functions #14695

@NyaomiDEV

Description

@NyaomiDEV

Describe the problem

I am writing this app here and I wanted to implement a Splash Screen retention mechanism using the Android 12 API.

https://developer.android.com/develop/ui/views/launch/splash-screen#suspend-drawing

Thing is, plugins get initialized way after TauriActivity.onCreate() gets called, so I cannot put a stop on frame drawing from within the plugin; I have to do it in my MainActivity.

The second problem I face, then, is that there's no way to perform a Kotlin-to-Kotlin call, even if I do have the Activity object, because from my plugin there's no way to import MainActivity.

Describe the solution you'd like

There should be some kind of way to register native plugins early, so that we can manipulate the Activity before the WebView gets mounted.

Alternatives considered

Event passing, Kotlin reflection, or telling Gradle to import my entire application as a dependency. I am not knowledgeable enough, probably.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions