Registering a class instance that is dependent on the MainActivity #3006
Unanswered
MartinRobins
asked this question in
.NET MAUI
Replies: 1 comment
-
I have a work around; though it feels dirty (so still looking for better ideas)... In my
It is of course dependent on my not trying to use the functionality within the M. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
On Android, Xamarin Forms was supported (is that really the right word) by the
FormsAppCompatActivity
and in my XF application I have an enhancedFormsAppCompatActivity
that provides access to the barcode scanning hardware on Zebra scanners (via their EMDK), the implementation of this being dependent on a number of events and properties of the Activity.I am able to then register the activity as an implementation of an interface using the
IPlatformInitializer
callback.With MAUI, the application is now the base (
MauiApplication
) and at the time thatCreateMauiApp
is created the activity does not appear to exist - in fact, it seems to be being created some time later in the process.I still need to use that functionality in my MAUI application and would like some suggestion as to how and when I can register the instance into the
IContainerRegistry
? I have already recreated theIPlatformInitializer
interface and implemented it for theMauiApplication
as I have to have different implementations for different devices and as such have different projects to generate the device specific outputs (despite them all being Android, the hardware is different on each device and I am interacting specifically with that hardware along with needing to intercept keyboard events (OnKeyDown
/OnKeyUp
).I guess what I am asking here is how I can register the instance of the
MainActivity
into theIContainerRegistry
once it has been created (which of course is after theMauiAppBuilder.Build
andPrismAppBuilder.RegisterTypes
have been called).Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions