We followed different approaches:
# Adding an `Init` method to the platform specific service implementation. Inside the `Init` method we call `MobileCore.Instance.RegisterService` to register the service itself. This method works pretty well. The only drawback is that the user must initialize both the core and all the services he plans to use # The MobileCore receives an instance of the Assembly of the running platform app. We tried to search inside the assembly for all the classes implementing the `IServiceModule` interface. This didn't work since the assembly will return only the classes inside the platform application project and not the classes inside its dependencies # We tried to use `AppDomain.CurrentDomain.GetAssemblies()` to get all the assemblies and then loop into all assembly to search for classes that implement services. This worked on android but doesn't work on iOS. The reason is that `GetAssemblies` returns only the list of *loaded* assembly. If the platform app does not have any hard dependency to the assembly (like directly instantiating a class), then (on iOS) the assembly is not loaded. If in Android you use `proguard` then it stop working on android too. |
|