4

I am a newbie with cross platform mobile development tools like PhoneGap and Xamarin so please excuse me if this question appears to be stupid.

My app would target Android, iOS, Windows Phone and Windows 8. I would want to maximize the amount of code I can reuse across different platforms. Therefore, I would prefer using HTML5, CSS and JavaScript for the UI layer (PhoneGap). However, I would prefer using C# instead of JavaScript to encapsulate my Business Logic and Data Access layers. That's because these layers may get pretty complex going forward and I would prefer C# over JavaScript for these layers anyday.

What I wanted to know was is it possible to use the best of both worlds (PhoneGap for UI and Xamarin for Business Logic and Data Access layers)? If yes then:

1) Should I be embedding Xamarin code (in the form of a class library / module) into PhoneGap or PhoneGap framework into Xamarin?

2) Would using both together have a considerable drain on performance? I really don't care about the app download size.

Thanks in advance.

Raj Chaudhary
  • 487
  • 1
  • 5
  • 10

1 Answers1

0

No. However, you can achieve something similar in Xamarin by building your app's UI using embedded HTML/JS/CSS and rendering it with the native browser control for each platform. I don't think this is a great solution, but if you really want to achieve maximum code sharing between platforms, and don't have an incredibly complex UI, this might be something worth considering.

Jason
  • 86,222
  • 15
  • 131
  • 146
  • Thanks Jason. Why do you write "I don't think this is a great solution"? Is it because I would need to replicate a lot of PhoneGap's Out-Of-The-Box JS to Native API bindings manually? Isn't there anyway I can somehow reuse PhoneGap's JS to Native API bindings for the UI layer while still using Xamarin for building / compiling the apps? – Raj Chaudhary Jan 13 '14 at 14:56
  • 1
    I don't think its a great solution because it bypasses one of Xamarin's greatest strengths, which is the ability to use NATIVE platform UI. If you use HTML for all of your UI, it's not going to be a native experience for the user. – Jason Jan 13 '14 at 15:01
  • False, you can, look at this: http://scott.blomqui.st/2012/08/embedding-cordova-phonegap-in-monotouch-apps/#footnote_0_353 – Gusman Jul 17 '14 at 22:03