Reputation: 84540
Android projects run natively on Java, and NDK projects basically work by having a special Activity that launches your native code. For example, SDL has an Activity that initializes SDL, sets up a display window, and then launches your project.
I'm trying to see how Xamarin does it. Technically, CLR code is managed code rather than native, but the CLR itself is native code and the whole thing would look like an NDK project to the Android runtime. I've been looking around, but I can't find where the Android project launcher is in Xamarin, and Googling it turns up nothing useful.
What is the mechanism by which Xamarin launches your CLR project on an Android device?
Upvotes: 1
Views: 94
Reputation: 16652
What is the mechanism by which Xamarin launches your CLR project on an Android device?
You can refer to Application Startup.
When an app is launched in Android device, Android will load it by specified @android:name in manifest, then usually all types will be instantiated by invoking ContentProvider.attachinfo()
method, Xamarin.Android then here adding a mono.MonoRuntimeProvider ContentProvider
during the build process. The mono.MonoRuntimeProvider.attachInfo()
method will then replace the native ContentProvider.attachinfo()
method to load Mono runtime into the process.
This is how I understand that document, please advise me if there is any mistake, many thanks.
Upvotes: 1