Now build your mobile app in c# with Sitecore on Xamarin
It’s really very easy to develop and deploy the native
mobile app for  c# developer on xamarin

Recently Sitecore has announced the partnership with
xamarin, Sitecore mobile SDK for xamarain is available for mobile app
development in c#. For more information on this visit
In this article I am focusing on how we can start with
xamarin development, including architecture, installation, development,
calling Sitecore Web APIrest service and bug fixing.

Xamarian framework allows to develop native app using c#
with Sitecore. sitecore expose Sitecore web item api to communicate with the
xamarain using mobile SDK.
The SDK core conforms to the PCL (Portable Class Library)
standard and has some platform specific plug-ins that are used to secure an end
user’s credentials.
All client-server communication is performed via the Sitecore Item
Xamarian installation:
If you are new to Xamarin framework so visit the site and download Xamarin for
download for windows

It’s available for 30 day trial version after the sign up
Once we download the XamarinInstaller next step is to
install the xamarian after installing the xamarian now  xamarian studio is available for native app
Choose a template>
Configure the project >

Create the project by entering any name>
Once you create the project, project file will open.
Notice that you can debug the native app by the simulator
and any device.
For use simulator, we need to download the android player or
use an existing supported device which is available in the framework itself.
Here we can download the device simulator
Now all installations have been done and application is
ready to run on simulator have a look on the device:
Now we are going to call the Sitecore API, once you have connected
with Sitecore then we can use all operations that are available in the Sitecore
We need to add below code to call the Sitecore API
using (var credentials = new SecureStringPasswordProvider(“username”,
)) // securing credentials, entered by the end user
  var session =
    .MediaLibraryRoot(“/sitecore/media library”)
) // Creating a session from credentials,
instance URL and settings
  // In order to fetch sample content we
have to build a request
  var request =
  // And execute it in a session
  var response = await session.ReadItemAsync(request);
  // Now that it has succeeded we are
able to access downloaded items
  ISitecoreItem item = response[0];
  // And content stored in its fields
  string fieldContent = item[“text”].RawValue;
Important: Bug

If you are running your app with using local Sitecore hosting
then you face the below exception, because the app is running on a device over
the internet and not resolve remote server


Need to Configure Remote Access to IIS Express:

By default, Windows 8 and IIS Express will not accept remote
connections. Before any remote devices, such as an Android device or an iPhone
can communicate with our WCF service we must make the following changes:

  1. Configure IIS Express to Accept Remote connections –
    This step involves editing the config file for IIS Express to accept remote connections
    on a specific port and then setting up a rule for IIS Express to accept the
    incoming traffic.
  2. Add an Exception to Windows Firewall – We must open up
    a port through Windows Firewall that remote applications can use to communicate
    with the WCF service.

You will need to know the IP address of your workstation. For
the purposes of this example we’ll assume that our workstation has the IP address

Let’s begin by configuring IIS Express to listen for
external requests. We do this by editing the configuration file for IIS Express
at %userprofile%documentsiisexpressconfigapplicationhost.config, as
shown in the following screenshot:
Locate the site element with the name HelloWorldWcfHost.
It should look something like the following XML snippet:
<site name=”HelloWorldWcfHost” id=”2″>
path=”/” applicationPool=”Clr4IntegratedAppPool”>
path=”/” physicalPath=”\vmware-hostShared Folderstomworkxamarincodeprivate-sampleswebservicesHelloWorldHelloWorldWcfHost”
protocol=”http” bindingInformation=”*:9607:localhost” />

We will need to add another binding to open up
port 9608 to outside traffic. Add the following XML to the bindingselement:

<binding protocol=”http” bindingInformation=”*:9608:″

This will configure IIS Express to accept HTTP traffic from
any remote IP address on port 9608 on the external IP address of the computer.
This above snippet assumes the IP address of the computer running IIS Express
is After the changes, the bindings element should look
like the following:

<site name=”HelloWorldWcfHost” id=”2″>    <application
path=”/” applicationPool=”Clr4IntegratedAppPool”>
path=”/” physicalPath=”\vmware-hostShared Folderstomworkxamarincodeprivate-sampleswebservicesHelloWorldHelloWorldWcfHost”
    </application>    <bindings>        <binding protocol=”http”
bindingInformation=”*:9607:localhost” />
protocol=”http” bindingInformation=”*:9608:″ />

1     Next, we need to configure IIS Express accept
incoming connections on port 9608. Startup up an administrative command prompt,
and run this command:

         >> netsh http add urlacl url= user=everyone

   The final step is to configure Windows Firewall
to permit external traffic on port 9608. 

    From an administrative command prompt,
run the following command:

>> netsh advfirewall firewall add rule name=”IISExpressXamarin”
dir=in protocol=tcp localport=9608 profile=private remoteip=localsubnet action=allo

         This command will allow incoming traffic on port
9608 from all devices on the same subnet as the Windows 8 workstation.

     I hope this article will help you 🙂

    Happy Sitecoring…

4 Replies to “Design native mobile Apps in C# with Sitecore and Xamarin”

  1. Superb explanation & it's too clear to understand the concept as well, keep sharing admin with some updated information with right examples.Keep update more posts.
    Mobile App Development Company in Dubai
    Android App Development Company in Dubai

  2. This was actually what i was looking for,and i am glad to came here you keep up the fantastic work!my weblog.. I like the trend that content is becoming more and more important.
    Mobile App Development Company In Chennai
    Android App Development Company In Chennai
    Android Application Development Company In Chennai

  3. Phenomenal Blog!!! thanks for your post and awaiting for your new updates…
    Xamarin Developers in Frisco

  4. This is a great post. Your Blog the very informative i have learned some information about your blog. We are top Mobile App Development | Mobile App Development Company in India | Website Development Company in Delhi | Website Designing Company in Gurgaon.

Leave a Reply

Your email address will not be published. Required fields are marked *