development with Xamarin
What is hybrid apps
A hybrid app is one that is written with the same technology used for websites and mobile web
implementations, and that is hosted or runs inside a native container on a mobile device. It is
the marriage of web technology and native execution.
Why hybrid apps
Use the skills you know and have today - If you’re already an accomplished web developer, building a hybrid
app requires a short and easy-to-achieve learning curve, and there are no new languages to learn.
Distribution through native app stores - Because hybrid apps use the native SDK to wrap the web app, they
can be distributed through the native app store, making discovery and distribution easier for users.
Access to native APIs - The web-to-native abstraction layer provided by hybrid frameworks provides
Runs locally on the device, and works when offline - Hybrid apps can package the required HTML, CSS and
and do not depend on a network connection to function.
makes it easy to share the majority of code between different platforms. While there may be some
differences between the rendering, it is no different than having to support multiple browsers.
Fast development time - If you already have an existing web app, or code base that is built on the web
platform, building a hybrid app is typically faster than writing an app using the native SDK, and because of the
ability to share code between platforms, significant time is saved through code reuse.
Displaying HTML content in native apps
Hybrid apps use a web view control (UIWebView on iOS, WebView on Android and others) to
engine (not the browser itself). WebKit is the browser rendering engine that is used on iOS,
hybrid app is rendered/processed by the WebKit rendering engine.
An HTML View can be a highly effective tool for displaying rich content in native applications.
With responsive design techniques (CSS 3 media queries) content can be made to seamlessly
adapt to different screen sizes and orientations.
Razor templating engine can be used in native applications to generate HTML content that
incorporates relevant data.
Razor templating engine.
Using Xamarin Studio, developers can use the Razor templating engine and C# to easily combine data with
Hybrid communications techniques
When an html page is loaded into a web view, it treats the links and forms as it would if the page
was loaded from a server. This means that if the user clicks a link or submits a form the web
view will attempt to navigate to the specified target.
Both iOS and Android provide a mechanism for application code to intercept these navigation
events so that app code can respond (if required). This feature is crucial to building hybrid apps
because it lets native code interact with the web view.
On Android simply subclass WebViewClient and then implement code to respond to the
public class RazorWebViewClient : WebViewClient
public override bool ShouldOverrideUrlLoading (WebView view, string url)