Run a Native Android / iOS app in the context of a Xamarin Forms app

JurgenJurgen Member ✭✭
edited September 2018 in Xamarin.Forms

Let's say I have a Xamarin forms app. One of the proposed features requires integration to an image processing external library; the problem is that the library does not support Xamarin. I have 2 native apps for Android & iOS respectively, that essentially consume this external library and do what we want to do; these apps are limited to this 1 functionality.

The obvious option would be to have 2 different apps; one would be the Xamarin Forms app and would be used for the general features; the second one would be to offer solely this added feature, over and above. For the second app, we would use the 2 existing native apps; customise them slightly to make them in line with our design and voila. This would work; but offering 2 apps when you can offer 1, would be too cumbersome and perhaps even a tad unprofessional; so we thought this should be the last resort.

The second option, would be to somehow create a Xamarin wrapper for the library and be able to use the library with Xamarin - which is something we looked into and came to the conclusion that it would require a lot of effort and time and therefore decided not to go down that route.

The last option would be to somehow run the native apps for both platforms within the context of the Xamarin Forms app. I found some links explaining how to use a Dependency service to load an Android Resource. I imagine the same could be done for iOS. However, I have not found an example for a complete native app (or at least several classes from a native app) running within Xamarin forms, neither have I found an example where the native app returns a result back to Xamarin.

Steps:

1) Xamarin Forms app is run
2) A button is clicked, which via the use of Dependency service, initiates the main activity of the Native app (be it Android or iOS)
3) The flow goes through 4 further activities until finally we have a processed image to return
4) The image array is returned to the Xamarin app Shared project

How possible and feasible is this? And are there any existing examples of this in action?

Answers

Sign In or Register to comment.